概述 jQuery.fx.off
返回值:Boolean
描述:全局的禁用所有动画。
当这个属性设置为true
的时候,调用时所有动画方法将立即设置元素为他们的最终状态,而不是显示效果。有时候确实有必要这样做:
动画可以通过设置这个属性为false
重新打开。
示例
切换开启和关闭动画。
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- div { width:50px; height:30px; margin:5px; float:left;
- background:green; }
- </style>
- <script src="http://code.jquery.com/jquery-latest.js"></script>
- </head>
- <body>
- <p><input type="button" value="Run"/> <button>Toggle fx</button></p>
- <div></div>
- <script>
- var toggleFx = function() {
- $.fx.off = !$.fx.off;
- };
- toggleFx();
-
- $("button").click(toggleFx)
-
- $("input").click(function(){
- $("div").toggle("slow");
- });
- </script>
-
- </body>
- </html>