Chill Web Designs
Chill Web Designs

Reputation: 1331

Run a function on complete of div fade out using mootools

I am new to mootools and use jQuery normally.

In jQuery i know I make a function run after the effect has been completed like so.

$('#id').fadeOut(500, function(){ // Run function on complete. });

But how do you do it with mootools? So far I have:

$('id').fade('out');

Upvotes: 0

Views: 1994

Answers (2)

Oskar Krawczyk
Oskar Krawczyk

Reputation: 3502

You need to set the options for the tween/fade.

var el = document.id('id');

el.set('tween', {
    onComplete: function(){
        // Run function on complete
    }
});

el.fade(0);

Upvotes: 4

Tim Wickstrom
Tim Wickstrom

Reputation: 5701

One of the reasons I prefer mootools is the way the code flows...

However if you like chaining everything together like jQuery you can do the same in mooTools

$('id').set('tween', {
    onComplete: function(){
        // Run function on complete
    }
}).fade(0);

And do it all in one chunk of code

Upvotes: 0

Related Questions