Cause the animation of a <div> element to run with less frames:
jQuery uses one global interval.
Before changing this property, stop all animations.
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#toggle").on("click", function(){ $("div").toggle(5000); });/*from w w w . j av a2 s.c o m*/ $("#interval").on("click", function(){ jQuery.fx.interval = 500; }); }); </script> </head> <body> <button id="toggle">Toggle div</button> <button id="interval">Run animation with less frames</button> <div style="background:#98bf21;height:100px;width:100px;margin:50px;"></div> </body> </html>
The jQuery.fx.interval property sets the animation firing rate in milliseconds.
The default value is 13 milliseconds.
This property has no effect in browsers that support the requestAnimationFrame
property.
jQuery.fx.interval = milliseconds;
Parameter | Optional | Description |
---|---|---|
milliseconds | Required. | Specifies the animation firing rate in milliseconds. Default is 13 milliseconds |