How to set a different frame rate for each animation in jQuery

I know that the frame rate in jQuery can be set via jQuery.fx.interval . However, for all , an internal jQuery animation function is used, such as slideDown , fadeIn and animate , etc.

I want to set the frame rate for each animate() , how can I archive this?

+6
source share
2 answers

On the API documentation page:

Since jQuery uses one global interval, the animation does not have to run or all animations must stop in order for this property to take effect.

Note. jQuery.fx.interval does not currently work in browsers that support the requestAnimationFrame property, such as Google Chrome 11. This behavior may be changed in a future version.

I take from this that you cannot set the frame rate for animate individual calls unless you want the animation to be completed, and even then you cannot guarantee the behavior. It is probably best to leave the setting alone.

+1
source

You can change this using fx.interval . Like this:

 jQuery.fx.interval = 100; $("input").click(function(){ $("div").toggle( 3000 ); }); 

Although the documentation states that:

jQuery.fx.interval does not currently work in browsers that support the requestAnimationFrame property, such as Google Chrome 11. This behavior may be changed in a future version.

0
source

Source: https://habr.com/ru/post/901984/


All Articles