在多次悬停时停止动画
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在多次悬停时停止动画相关的知识,希望对你有一定的参考价值。
For user-friendly animations on hover event.Prevents repeating animations when hovering object many many times.
Example needs "jquery.color" plugin for color animations. But you can use any animations you want.
$('a.coollink').hover(function(){ $(this).stop().animate({ // magic here, stop THIS object to animate // and do animate from begin backgroundColor: '#21545A', //animate what you want color: '#FFF' }, 500); }, function(){ $(this).stop().animate({ // magic here, stop THIS object to animate // and do animate from begin backgroundColor: '#FFF', //animate what you want color: '#797979' }, 500); });
以上是关于在多次悬停时停止动画的主要内容,如果未能解决你的问题,请参考以下文章