所以,
我有这个演示网站:
如果将鼠标悬停在主标题上(不在ie中).您会注意到图像有点变化,
这就是我要的.
然而,敏锐的目光会注意到,如果你在开 - 关 - 开 - 关 - 开 - 关 - 它将排队事件.
我如何阻止它做这种行为?
j .stop()求救.
$('#element').stop(true, true).animate({});
Run Code Online (Sandbox Code Playgroud)
如果你使用jQuery做任何类型的动画,stop()将结束队列.第一个参数表示是否清除完整队列,第二个参数表示是否跳转到当前运行动画的结尾.
你在这里得到的另一个选择是检查元素当前是否已设置动画,如果是,则跳过新.animate方法.例:
$('#element').hover(function(){
if(!$(this).is(':animated'){ // only go in here if $(this) is NOT animated
// $(this).animate({});
}
}, function(){
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1235 次 |
| 最近记录: |