Jquery stop method
Advertisements
stop() method
JQuery stop() method is used to stop animations or effects before it is finished.
Syntax
$(selector).stop(stopAll,goToEnd);
Example of stop method
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <style> #flip { padding: 5px; font-size: 14px; text-align: center; background-color: #3399FF; color: white; border: solid 1px #666; border-radius: 3px; } #panel { font-size: 18px; text-align: center; background-color: #3399FF; color: white; border: solid 1px #666; border-radius: 3px; padding: 50px; display: none; } </style> <script> $(document).ready(function(){ $("#flip").click(function(){ $("#panel").slideDown(10000); }); $("#stop").click(function(){ $("#panel").stop(); }); }); </script> </head> <body> <button id="stop">Stop sliding</button> <div id="flip">Click Here to slide down panel</div> <div id="panel">Hello world!</div> </body> </html>
Output
Click Here to slide down panel
Hello world!
Google Advertisment