home

Jquery Stop

Jquery Stop method is used to stop current effect when ever you want, even that can be anything like fade In, fadeout, toggle or any effects. here we have syntax of jquery stop() method and example code, in the next we have two functions one is for starts() and other one is for stop() method, when you click on start button(id="start") container div will slide down and when you clicks on stop button(id="stop"), the scrolling will be stop (container class div) on that position, again if you want to start you can click on start button then scrolling will start from the resume the start point. in the below we have code section with simple basic example containing with demo.

Syntax :$(selector).stop(stopAll,goToEnd);
//Jquery Stop() method code:-
 $(document).ready(function(){
     $("#start").click(function(){
         $("#container").slideDown(3000);
        });
     $("#stop").click(function(){
         $("#container").stop();
        });
  });

// Html code:-
<button id="stop">Stop sliding</button>
<button id="start">Click to slide down panel</button>
<div id="container">Hello world!</div>

//styles
  #start, #container{
    padding: 5px;
    font-size: 18px;
    text-align: center;
    background-color: #f00;
    color: white;
    border: solid 1px #666;
    border-radius: 3px;
}

  #container{
    padding: 50px;
    display: none;
    background-color: #ff0;
}
Click Here to Stop sliding
Click Here to slide Down
I am going scroll down

Jquery Callback

Callback function will run when current function completed. this will in many cases like when you want to populate some messages in alert after completion of your task or function by the time you might need to use jquery callback function, to understand more about jquery callback function check snippet of below code. when your function overs or completed then alert box throws some message.

$("Button").click(function(){
       alert("Clicked on button");
    });
});