Giter Club home page Giter Club logo

Comments (4)

lizzie avatar lizzie commented on August 17, 2024

switchable 通过切换 display:block /none ,来显示不同的panel ,至于panel 里面是什么,不考虑的。像你所说的图表情况display: none 会对绘制有影响,我觉得可以换种方式实现,switchable 有 switch 事件在切换之后触发,是否你可以在这时再初始化图表。应该可以避免display: none 是图表定位错误的问题了。

from switchable.

fayching avatar fayching commented on August 17, 2024

可能我的实际场景更复杂一点,我这两个要切换的图表是要用ajax实时更新的,就是说我隔几秒要重新画下图,在这时间里切换了tab还是会有display:none的问题;还有flash在tab中,如果使用这种方式切换每次都要重新请求,实在没必要。

from switchable.

lizzie avatar lizzie commented on August 17, 2024

@fayching 想起来了, 你这个需求可以通过自定义 effect 来实现, 你可以自定义 effect 为函数, 看 https://github.com/aralejs/switchable/blob/master/src/plugins/effects.js#L90 , 函数传参为 panelInfo, 在这里进行设置

                if (fromPanel[0]) {
                 toPanel.css({
                    opacity: 1 ,
                    position: 'absolute',
                    zIndex:  9 
                });
                fromPanel.css({
                    opacity: 0,
                    position: 'absolute',
                    zIndex:  1
                });

你试试

from switchable.

fayching avatar fayching commented on August 17, 2024

ok

from switchable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.