jQuery.fx.off
S2C 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
isfalse
, 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
$(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");
}
});
Related Tutorials
jQuery Intermediate Tutorials - Lesson 8 - Controlling Effects