Home > Web Front-end > JS Tutorial > body text

Example analysis of the stop() method of animate in jquery_jquery

WBOY
Release: 2016-05-16 16:17:01
Original
1296 people have browsed it

This article uses an example to analyze the function of the stop() method of animate in jquery. Share it with everyone for your reference. The specific analysis is as follows:

Here is a code snippet from a video to tell you the function 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 id="flyul"> 
<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.2.min.js"></script> 
<script type="text/javascript"> 
$('#flyul li').mouseenter(function(){ 
$(this).stop().animate({
//将此处改为$(this).animate({对比一下不带stop的运行效果
width:'300px' 
},1000); 
}); 
$('#flyul li').mouseleave(function(){ 
$(this).stop().animate({
//将此处改为$(this).animate({对比一下不带stop的运行效果
width:'50px' 
},1000); 
}); 
</script>
Copy after login

I hope this article will be helpful to everyone’s jQuery programming.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template