jQuery.fx.interval属性示例

jQuery.fx.interval属性示例

jQuery.fx.interval属性在jQuery中是用来修改动画运行的每秒帧数和改变动画发射率的毫秒。它的默认值是13ms。

语法:

jQuery.fx.interval = milliseconds;

参数。本方法接受单参数milliseconds,这是必须的。它用于指定动画的发射率,单位是毫秒。它的默认值是13毫秒。

示例 1: 这个例子使用jQuery.fx.interval属性来改变动画的发射速度。

<!DOCTYPE html>
<html>
  
<head> 
    <title>
        jQuery jQuery.fx.interval Property
    </title>
      
    <script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
    </script>
      
    <style>
        .box {
            background:green;
            height:100px;
            width:100px;
            margin:50px;
        }
    </style>
</head> 
  
<body>
    <center>
        <h1 style = "color:green;" >  
            GeeksForGeeks
        </h1>  
          
        <h2> jQuery.fx.interval property</h2>
          
        <button id="toggle">
            Toggle div
        </button>
          
        <button id="interval">
            Run animation with less frames
        </button>
       
        <div class="box"></div>
          
        <!-- Script to illustrate jQuery.fx.interval
            property -->
        <script>
            (document).ready(function(){
                ("#toggle").on("click", function() {
                    ("div").toggle(5000);
                });
                  
                ("#interval").on("click", function() {
                    jQuery.fx.interval = 500;
                });
            });
        </script>
    </center>
</body>
  
</html>  

输出
jQuery.fx.interval属性示例

示例 2: 这个例子使用jQuery.fx.interval属性来改变动画的发射速度。

<!DOCTYPE html>
<html>
  
<head> 
    <title>
        jQuery jQuery.fx.interval Property
    </title>
      
    <script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
    </script>
      
    <style>
        .box {
            background:green;
            height:100px;
            width:100px;
            margin:50px;
        }
    </style>
</head> 
  
<body>
    <center>
        <h1 style = "color:green;" >  
            GeeksForGeeks
        </h1>  
          
        <h2> jQuery.fx.interval property</h2>
          
        <button id="toggle">
            Toggle div
        </button>
          
        <button id="interval">
            Run animation with less frames
        </button>
       
        <div class="box"></div>
          
        <!-- Script to illustrate jQuery.fx.interval
            property -->
        <script>
            (document).ready(function(){
                ("#toggle").on("click", function() {
                    ("div").toggle(500);
                });
                  
                ("#interval").on("click", function() {
                    jQuery.fx.interval = 5000;
                });
            });
        </script>
    </center>
</body>
  
</html>  

输出:
jQuery.fx.interval属性示例

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程