用一个定时器试试吧,类似这样 var timer = null;
$("#test").on("mouseenter", function(){
timer = setTimeout(function(){
$("#title").fadeIn();
}, 300);
});
$("#test").on("mouseout", function(){
if(timer){
clearTimeout(timer);
}
$("#title").fadeOut();
});
$("#test").on("mouseenter", function(){
timer = setTimeout(function(){
$("#title").fadeIn();
}, 300);
});
$("#test").on("mouseout", function(){
if(timer){
clearTimeout(timer);
}
$("#title").fadeOut();
});
我再等等看是否有通过delay方案能解决的jquery版本。
我再等等看是否有通过delay方案能解决的jquery版本。
那你在show方法里带个参数试试:
$("#title").stop(true).delay(800).show(1);
我再等等看是否有通过delay方案能解决的jquery版本。
那你在show方法里带个参数试试:
$("#title").stop(true).delay(800).show(1);你好,根据你的建议修改js如下$(function() {
$("#test").bind({"mouseenter": function() {
$("#title").stop(true).delay(50).show(1);
},
"mouseout": function() {
$("#title").stop(true).hide();
}});
});
在正常操作时可以,但是如果快速划动几次后就再也不能show了,不知道是什么原因??
求解答。
一开始title是这样子的
<div id="title">
Hello World.
</div>
通过跟踪代码可以发现,当快速划动几次后,html代码变成如下的样子:<div id="title" style="display: none; height: 1px; margin: 0px; padding: 0px; width: 1px; overflow: hidden; opacity: 0;">
Hello World.
</div>
是什么原因呢??透明了,长度宽度变成了1,还增加了不少其它属性,为什么,求解答??
不过把stop(true, true)这样子貌似好点
stop(true, true)这样定义leave
试试