我有一个简单的悬停淡入和淡出,正如您将在我的代码中看到的那样。问题是,为了防止淡入/淡出发生 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/