Edit This Code:
See Result »
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.bootcss.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script> $(document).ready(function(){ $("#disable").click(function(){ jQuery.fx.off = true; }); $("#enable").click(function(){ jQuery.fx.off = false; }); $("#toggle").click(function(){ $("div").toggle("slow"); }); }); </script> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?73c27e26f610eb3c9f3feb0c75b03925"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </head> <body> <p>When the "Toggle animation" button is pressed, we toggle between hiding and showing the div with a slow animation. Press "Enable" or "Disable" to turn animations on and off.</p> <button id="disable">jQuery.fx.off = true ( Disable )</button> <button id="enable">jQuery.fx.off = false ( Enable )</button> <br><br> <button id="toggle">Toggle animation</button> <div style="background:#98bf21;height:100px;width:100px;margin:50px;"></div> </body> </html>
Result: