Toggle animation on and off using jquery
HTML Code:
<!DOCTYPE html> <html> <head> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <meta charset="utf-8"> <title>Toggle animation on and off</title> </head> <body> <button id="enable">(Enable) jQuery.fx.off = false)</button> <button id="disable">(Disable) jQuery.fx.off = true)</button> <br><br> <button id="toggle">Toggle animation</button> <div style="background:#98bf21;height:100px;width:100px;margin:50px;"></div> </body> </html>
JavaScript Code :
$("#enable").click(function(){ jQuery.fx.off = false; }); $("#disable").click(function(){ jQuery.fx.off = true; }); $("#toggle").click(function(){ $("div").toggle("slow"); });
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
HTML Code:
JavaScript Code :