开发者

In mootools how do you delay the next method?

开发者 https://www.devze.com 2023-04-10 10:34 出处:网络
i want to put a delay in between reveal() and dissolve(). $(\'foo\').reveal().set(\'html\',\'my message\').delay(500).dissolve();

i want to put a delay in between reveal() and dissolve().

$('foo').reveal().set('html','my message').delay(500).dissolve();

I can see that this is not correct but I cannot figure out the right way to do it?

Any help?

Solved:

after messing around i realized that delay should go on the item you want to delay instead of on the item that comes before the delay.

$('foo').reveal().set('html','test');
(func开发者_运维问答tion(){$('foo').dissolve();}).delay(4000);


If you want the delay to start 'after' the reveal has finished, you could do:

var element = $('foo');

element
    .set('html','my message')
    .reveal()
    .get('reveal').chain(function(){
        //you're sure reveal has finished!
        (function(){element.dissolve()}).delay(500); //delay the dissolve
    });

http://jsfiddle.net/steweb/JNvPM/


In Mootools you need the chain method to do this.

http://mootools.net/docs/core/Class/Class.Extras#Chain:chain

http://mootools.net/docs/more/Class/Chain.Wait

0

精彩评论

暂无评论...
验证码 换一张
取 消