How to use Effect ClearQueue() Method in JQuery

In this article I am going to explain about Effect ClearQueue() Method in jquery.
  • 2001

jQuery ClearQueue() Method

ClearQueue() function mainly use for stop all animated function in the queue. ClearQueue() function only work with animate() function.




In this example when you will click on start then animation will be start as soon as you click on stop then animation will be stoped.



<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $("#but1").click(function () {

            $("#dv").animate({ height: 250 }, "slow");

            $("#dv").animate({ width: 250 }, "slow");

            $("#dv").queue(function () {

                $(this).css("background-color", "orange");



            $("#dv").animate({ height: 100 }, "slow");

            $("#dv").animate({ width: 75 }, "slow");


        $("#but2").click(function () {








<p><button id="but1">Start</button>

<button id="but2">Stop</button></p>

<div id="dv" style="background:blue;height:75px;width:100px;position:relative">










You may also want to read these related articles: here
Ask Your Question 
Got a programming related question? You may want to post your question here


© 2020 DotNetHeaven. All rights reserved.