当鼠标悬停div
以循环并更改background-image
并停止其他 divs
时,我已成功完成周期
这会发生这样的情况:div
有一个标题,当鼠标悬停在div
时会出现,如果我抓住光标并将其放在标题上,然后再将光标移动到另一个div
标题,循环在divs
中继续,我不愿意。
我以这种方式清除interval cycle
:clearInterval(theInterval);
但是,不知何故,当标题被徘徊时它并没有阻止其他人的循环。
问题可以在 JSFiddle 中看到。
模拟问题:
模拟其工作原理:
答案 0 :(得分:0)
我认为mouseover
事件的性质存在问题,而div正处于如此接近的状态。请尝试使用悬停事件。见this fiddle
本质上:
$('.collection-photo').hover(function(){
// mouse over stuff here
}, function() {
// mouse out stuff here
});