HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <h1>jQuery fx.off</h1> <button id="mySlideToggle">slideToggle</button> <button id="myAnimationOff">animation off</button> <button id="myAnimationOn">animation on</button> <script> $(document).ready(function(){ $("#mySlideToggle").click(function(){ $("p").slideToggle("1500"); }); $("#myAnimationOff").click(function(){ jQuery.fx.off = true; }); $("#myAnimationOn").click(function(){ jQuery.fx.off = false; }); }); </script> <p><strong>Note</strong>: jQuery.fx.off will disable all jquery animation. Try the following</p> <p>Click on the slideToggle button twice</p> <p>Off the animation and click on the slideToggle button twice</p> <p>On the animation and click on the slideToggle button twice</p> </body> </html>
OUTPUT
×

Save as Private