jQuery.fx.off Property

The jQuery.fx.off property allows you to globally disable animations. When this property is set to true, all animation methods will set elements to their final state, without showing any effects. To undo this setting, set this property back to false.

Example

Let's assume we have a green rectangle, we will start the animation by clicking on the button #start using the method toggle, and with the button #toggle we will turn the animation on and off using the setting jQuery.fx.off. With the animation turned off, our rectangle will simply appear and disappear without any effects:

html<input id="start" type="button" value="start">
<button id="toggle">toggle fx</button>
<div></div>
cssdiv {
  width: 50px;
  height: 30px;
  margin: 5px;
  float: left;
  background: green;
}
javascriptlet toggleFx = function() {
  $.fx.off = !$.fx.off;
};   

$('#toggle').click(toggleFx);

$('#start').click(function() {
  $('div').toggle('slow');
});

See also

  • method animate,
    which animates the properties of elements