jquery jQuery.fx.interval attribute


  Translation results:

jQuery

Instance;Event;Performance;Mobile;Basic

fx

abbr.fractures Fractured fractured; for eksempel (Dano-Norwegian=for example) (Norwegian) for example; fixed fixed

interval

英[ˈɪntəvl] 美[ˈɪntərvl]

n.Interval; intermission; (mathematics) interval

jquery jQuery.fx.interval attributesyntax

Function:jQuery.fx.interval property is used to change the animation running rate in milliseconds. This property can be manipulated to adjust the number of frames per second at which the animation runs. The default value is 13 milliseconds. This property is often used to modify the number of frames per second at which the animation runs. Lowering this value can make animations run more smoothly in faster browsers, but doing so may impact performance. Since jQuery uses a global interval, in order for this property to take effect, the animation should no longer be running or all animations should be stopped first. This attribute has no effect in browsers that support the requestAnimationFrame attribute, such as Google Chrome 11.

Syntax: jQuery.fx.interval = milliseconds;

Parameters:

ParameterDescription
milliseconds Required. Specifies the animation run rate in milliseconds. The default is 13 milliseconds.

jquery jQuery.fx.interval attributeexample

<!DOCTYPE html>
<html>
<head>
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("#toggle").on("click",function(){
    $("div").toggle(5000);
  });
  $("#interval").on("click",function(){
    jQuery.fx.interval = 500;
  });
});
</script>
</head>
<body>

<button id="toggle">切换 div</button>
<button id="interval">以较少的帧数来运行动画</button>

<div style="background:#98bf21;height:100px;width:100px;margin:50px;">
</div>

</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A