This article analyzes the role of stop() method of animate in jquery. Share it for your reference. The specific analysis is as follows:
Here we use a code snippet in a video to tell you the role of stop():
The code is as follows:
<style type="text/css"> ul li{ width:50px; height:30px; background:#333; margin-bottom:10px; color:#fff;} </style> <ul > <li>wod a </li> <li>wod a </li> <li>wod a </li> <li>wod a </li> <li>wod a </li> </ul> <script type="text/javascript" src="js/jquery-1.7."></script> <script type="text/javascript"> $('#flyul li').mouseenter(function(){ $(this).stop().animate({ //Change this to $(this).animate({Compare the running effect without stopwidth:'300px' },1000); }); $('#flyul li').mouseleave(function(){ $(this).stop().animate({ //Change this to $(this).animate({Compare the running effect without stopwidth:'50px' },1000); }); </script>
I hope this article will be helpful to everyone's jQuery programming.