简体   繁体   中英

MooTools Fx.Slide duration

I use MooTools Fx.Slide to open / close different containers on the same page.
Some containers hold only little text , others very long text .

When I set the duration to, say, 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/

How can I have the containers open at the same "average speed" ?

Here is a option, more of a 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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