Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery show/hide with callback animates (dont want it)

When I add callback to show/hide, my element starts to animate. I dont want it. I just need to add a function AFTER show/hide is finished.

I cannot nullify time, cause i use option-based function (element CAN be animated, but if its not wanted, it must just show-hide. With callback attached to it, it does not work :(

Is there a neat trick to elliminate animation on show/hide? OR is there another way to add a function AFTER animation has finished?

Thanks in advance!

Found the solution! Just do:

show('','', function()...
like image 639
fallenboy Avatar asked Oct 14 '11 14:10

fallenboy


1 Answers

From the documentation:

.show( [duration] [, easing] [, callback] )

To specifically disable the animation, set it's duration to zero and no easing:

.show(0,'', function(){
    //your code here
});
like image 138
Ryre Avatar answered Sep 30 '22 13:09

Ryre