jQuery > Effects methods

jQuery.fx.off - Toggle animation effect in jQuery

How to on and off the animation effect in jQuery?

To switch off and on the animation effect for the entire page, jQuery.fx.off can be used. This disables all animations globally and set the elements to its final state directly ie. the functionality of all methods remain same but animation effect is not visible while executing the method.

<input type="button" id="btnFxOff" value="Toggle Animation" />

<script> $("#btnFxOff").click(function () { $.fx.off = !$.fx.off; });

In the above code when “btnFxOff” will be clicked then the animations will not work on the page and if animation is called the element will go to its final state rather than animating and going to the final state. For example .slideUp() function will hide the element but without sliding effect.

 Views: 4597 | Post Order: 105

Write for us

Hosting Recommendations