jquery中animate的stop()方法作用实例分析

这篇文章主要介绍了jquery中animate的stop()方法作用,实例分析了animate的stop()方法在视频播放代码中的使用技巧,感兴趣的朋友可以对比分析一下带stop方法与不带stop方法运行效果的区别,需要的朋友可以参考下

本文实例分析了jquery中animate的stop()方法作用。分享给大家供大家参考。具体分析如下:

这里以一个视频中的代码段告诉你stop()的作用:

代码如下:

<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="https://www.jb51.net/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>

希望本文所述对大家的jQuery程序设计有所帮助。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgfpyp.html