ドキュメント

Effects/jQuery.fx.off

From jQuery JavaScript Library

Jump to: navigation, search

« Back to Effects

jQuery.fx.off

Globally disable all animations.

Setting this property to true will disable all animations from occurring (the effect will happen instantaneously, instead). This may be desirable for a couple reasons:

  1. You're using jQuery on a low-resource device.
  2. Some of your users are encountering accessibility problems with the animations.

Animations can be turned back on by setting the property to false.

Examples:

Run a disabled animation

    jQuery.fx.off = false;
    $("input").click(function(){
      $("div").toggle("slow");
    });

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    
    jQuery.fx.off = false;
    $("input").click(function(){
      $("div").toggle("slow");
    });

  });
  </script>
  <style>
  body { cursor:pointer; }
  div { width:50px; height:30px; margin:5px; float:left;
        background:green; }
  span { color:red; }
  </style>
</head>
<body>
  <input type="button" value="Run"/><div></div>
</body>
</html>

NameType