javascript - 使用 .stop() 后悬停卡住时的 jQuery fadeIn 和 fadeOut

标签 javascript jquery hover fadein fadeout

我有一个简单的悬停淡入和淡出,正如您将在我的代码中看到的那样。问题是,为了防止淡入/淡出发生 100 次,我必须在调用淡入/淡出之前使用 .stop() ,但是停止似乎会卡住元素淡入淡出,然后当您将鼠标悬停在它上面时只会淡出只要你允许,你可以在这里看到一个例子:http://ena.vu/jhover/jhover.html

jQ 代码是:


obj.children().hover(function(e){ 
$(this).find("."+options.title_class).stop().fadeIn(options.title_speed);
},function(){
$(this).find("."+options.title_class).stop().fadeOut(options.title_speed);
});

最佳答案

obj.children().hover(function(e){  
$(this).find("."+options.title_class).stop().fadeTo(options.title_speed,1); 
},function(){ 
$(this).find("."+options.title_class).stop().fadeTo(options.title_speed,0); 
});

我相信这对你有用。 了解更多 fadeTo

关于javascript - 使用 .stop() 后悬停卡住时的 jQuery fadeIn 和 fadeOut,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4384165/

相关文章:

html css 导航列表悬停问题

css - 更新主题后悬停图像不显示

html - Css 将 <a> 悬停在 <td> 内

javascript - JQuery - 添加后删除 cssObject?

javascript - Bootstrap无冲突使用

javascript - atom ide 是如何工作的

javascript - 修复 header 偏移 html anchor

javascript - 使用 'this' 关键字和 css 伪选择器

javascript - 将选中的属性添加到 TR 中最接近的复选框

带有部分 preventDefault 的 javascript 拖放