jQuery.fx.off
jQuery.fx.off 返回: Boolean
描述: 全局禁用所有動畫。
version added: 1.3jQuery.fx.off
當這個屬性設置為true的時候,調(diào)用時所有動畫方法將立即設置元素為他們的最終狀態(tài),而不是顯示效果。這可能令人滿意的幾個原因:
- jQuery是被用在低資源設備。
- 動畫使用戶遇到可訪問性問題(查看這篇文章獲得更多信息 Turn Off Animation)。
動畫可以通過設置這個屬性為false重新打開。
Example:
Toggle animation on and off
<!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.min.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>