jQuery | jQuery.fx.interval Property with example

The jQuery.fx.interval property in jQuery is used to to modify the number of frames per second at which animations will run and to change the animation firing rate in milliseconds. Its default value is 13ms.

Syntax:

jQuery.fx.interval = milliseconds;

Parameters: This method accepts single parameter milliseconds which is mandatory. It is used to specify the animation firing rate in milliseconds. It default value is 13 milliseconds.

Example 1: This example uses jQuery.fx.interval property to change the animation firing rate.



filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head
    <title>
        jQuery jQuery.fx.interval Property
    </title>
      
    <script src=
    </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>  

chevron_right


Output

Example 2: This example uses jQuery.fx.interval property to change the animation firing rate.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head
    <title>
        jQuery jQuery.fx.interval Property
    </title>
      
    <script src=
    </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>  

chevron_right


Output:



My Personal Notes arrow_drop_up

Small things always make you to think big

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.