jQuery API

jQuery.fx.off

jQuery.fx.off Returns: Boolean

Description: Globally disable all animations.

  • version added: 1.3jQuery.fx.off

When this property is set to true, all animation methods will immediately set elements to their final state when called, rather than displaying an effect. This may be desirable for a couple reasons:

  • jQuery is being used on a low-resource device.
  • Users are encountering accessibility problems with the animations (see the article Turn Off Animation for more information).

Animations can be turned back on by setting the property to 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.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>

Demo:

Support and Contributions

Need help with jQuery.fx.off or have a question about it? Visit the jQuery Forum or the #jquery channel on irc.freenode.net.

Think you've discovered a jQuery bug related to jQuery.fx.off? Report it to the jQuery core team.

Found a problem with this documentation? Report it on the GitHub issue tracker

  • howardyeend

    useful to note that currently-in-progress animations will still continue; calling this does not cause all currently animating animations to jump to their final state. The docs do state this; “all animation methods will immediately set elements to their final state **when called**”, but I felt it was worth noting in more explicit terms.

    • http://twitter.com/cmcculloh Christopher McCulloh

      So, how *do* you set a currently animating animation to it’s final state?

      • http://www.learningjquery.com/ Karl Swedberg

        You can do that by using the .stop() method.

  • Saqibshamim

    very nice & helpfull sites

  • DK

    There's something wrong with the DISQUS drop list menu.