JQuery show / hide with callback support (don't want this)

When I add a callback to show / hide, my element starts animating. I do not want it. I just need to add the function AFTER completion / hiding.

I cannot nullify the time because I am using the option-based function (the element MAY be animated, but if it is not needed, it should just show-hide. It does not work on a callback :(

Is there a neat trick to elimizing animations in show / hide? OR is there any other way to add the AFTER animation function?

Thanks in advance!

The solution found! Just do:

show('','', function()... 
+6
source share
1 answer

From the documentation :

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

To specifically disable the animation, set it to zero and do not loosen it:

 .show(0,'', function(){ //your code here }); 
+17
source

Source: https://habr.com/ru/post/899304/


All Articles