87,904
社区成员
发帖
与我相关
我的任务
分享
<div id="test">offset</div>
<div id="title">
Hello World.
</div>
$(function() {
$("#test").bind({"mouseenter": function() {
$("#title").stop(true).delay(100).show();
},
"mouseout": function() {
$("#title").hide();
}});
});
#title {
width:100px;
height:100px;
display:none;
position:absolute;
background-color:red;
}
#test {
position:absolute;
text-align:center;
left:20%;
top:20%;
right:50%;
bottom:50%;
background-color:gray;
border: 1px solid ;
}
$(function() {
$("#test").bind({"mouseenter": function() {
$("#title").stop(true).delay(50).show(1);
},
"mouseout": function() {
$("#title").stop(true).hide();
}});
});
在正常操作时可以,但是如果快速划动几次后就再也不能show了,不知道是什么原因??
求解答。
<div id="title" style="display: none; height: 1px; margin: 0px; padding: 0px; width: 1px; overflow: hidden; opacity: 0;">
Hello World.
</div>
是什么原因呢??透明了,长度宽度变成了1,还增加了不少其它属性,为什么,求解答??
var timer = null;
$("#test").on("mouseenter", function(){
timer = setTimeout(function(){
$("#title").fadeIn();
}, 300);
});
$("#test").on("mouseout", function(){
if(timer){
clearTimeout(timer);
}
$("#title").fadeOut();
});