Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery animate with function won't queue: false

I'm having trouble with the following code:

$(".active").animate({
            opacity:0
        },{queue: false, duration:1000}, function(){  
            console.log("queue??");
            $(".active").css('display', 'none');
            $(".active").removeClass("active");
            initiatePage();
        });

After adding queue: false, the function() ain't running at all... but if I don't, they just queue up, and I don't want that to happen either.. Is there a way to make this animation and everything going with it queue: false??

Let me know if I can provide anything to make it easier for you to help..

Thanks!

like image 549
Mikkel Ulstrup Larsen Avatar asked Nov 09 '12 18:11

Mikkel Ulstrup Larsen


1 Answers

Read the animate() manual. When using the options the callback should be passed using the complete option.

complete: A function to call once the animation is complete.

$(".active").animate({opacity:0},{
    queue       : false,
    duration    : 1000,
    complete    : function() {  
        $(this).hide().removeClass('active');
        initiatePage();
    }});
like image 72
iMoses Avatar answered Oct 04 '22 23:10

iMoses