简体   繁体   English

MooTools Fx。幻灯片时长

[英]MooTools Fx.Slide duration

I use MooTools Fx.Slide to open / close different containers on the same page. 我使用MooTools Fx.Slide在同一页面上打开/关闭不同的容器。
Some containers hold only little text , others very long text . 一些容器只容纳很少的文本 ,其他容器则容纳很长的文本

When I set the duration to, say, 500 ... 当我将duration设置为例如500 ...

var thisSlider = 
    new Fx.Slide(item.getElement('.main'), 
    {duration: 500}
);

The small container opens slowly, the big one is rushing up and down very fast... 小容器慢慢打开,大容器非常迅速地上下冲动。

see http://jsfiddle.net/6H9f5/1/ 参见http://jsfiddle.net/6H9f5/1/

How can I have the containers open at the same "average speed" ? 如何以相同的“平均速度”打开容器?

Here is a option, more of a hack. 这是一个选择,更多的是hack。 Not sure it qualifies as an answer :) 不确定它是否可以作为答案:)

    var itemMain = item.getElement('.main');
    var thisHeight = itemMain.getSize().y;
    var speed = 500 + (thisHeight * 3);
    console.log(speed); // to check the values proportion
    var thisSlider = new Fx.Slide(itemMain,{
        duration: speed
    });

Fiddle 小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM