holyredbeard
holyredbeard

Reputation: 21248

Function won't execute after animation

After the animation below is finished, I want to run a function to do some stuff, but the function won't execute (no exceptions thrown).

What am I doing wrong?

rb.animate({
    'right': '0'
}, { duration: this.animSpeed, queue: false }, function() {
    block.find('.menu-handle').css({
        'visibility': 'visible'
    });
    block.find('.sub-menu').hide();
});

Upvotes: 0

Views: 62

Answers (2)

Rohan Kumar
Rohan Kumar

Reputation: 40639

Try it like,

rb.animate({
    'right': '0'
}, { duration: this.animSpeed, queue: false ,complete: function() {// use complete
    block.find('.menu-handle').css({
        'visibility': 'visible'
    });
    block.find('.sub-menu').hide();
}});//// use complete in the second option of animate function

Docs http://api.jquery.com/animate/

Upvotes: 0

Chaitanya Munipalle
Chaitanya Munipalle

Reputation: 724

Use complete in the options, since you're using the two-argument version of animate.

rb.animate({
    'right': '100'
}, { duration: 1000, queue: false , complete: function() {
    block.find('.menu-handle').css({
        visibility': 'visible'
    });
    block.find('.sub-menu').hide();
}});

Upvotes: 2

Related Questions