jQuery.fx.offS2C Home « Effects « jQuery.fx.off

Stop or start animations globally property.

Description

The jQuery.fx.off property disables/enables all animations globally.

  • The default value of jQuery.fx.off is false, which allows all animations to run normally.
  • 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.

Shorthand version $.fx.off

Syntax

Signature Description
$.fx.off = true;Disable/enable all animations globally.

Parameters

None.

Return

A JavaScript Boolean object.

jQuery.fx.off ExamplesTop

Disable/enable all animations globally.

In the example below when the left button is pressed we toggle hiding and showing the curry image with a slow animation.

When the right button is pressed we turn animations off and on. Tinker with the buttons to see how toggling with the jQuery.fx.off property disables/reenables animations

a picture of curry a picture of curry



$(function(){
  var toggleFx = function() {
    $.fx.off = !$.fx.off;
    alert('Animations turned off: ' + $.fx.off);
  };
  $('#btn3').on('click', function() {
    animateImg();
  });
  $('#btn4').click(toggleFx);
  
  function animateImg() {
    $("#curry2").toggle("slow");
  }
});

Press the buttons below to action the above code: