[英]jQuery: mouseover on a background div “through” a foreground tooltip?
我有一個背景div和一個前景div,當背景被遮住時淡入,並在背景被淘汰時淡出。
但是當前景淡入時,它會從背景中竊取焦點並且工具提示最終“閃爍”:
如何保持工具提示可見並停止閃爍?
謝謝
把鼠標放在我身上 這需要保持可見,而不是閃光,直到我鼠標離開綠色方塊!
JQUERY
$("#background").hover(function(){
$("#tooltip").fadeIn();
},function(){
$("#tooltip").fadeOut();
});
如果你想#tooltip重疊“ Mouse over me ”文本。
#tooltip {
display: none;
width: 130px;
height: 130px;
background: red;
top:0;
}
第二種方式
var i=0;
$("#background").hover(function(){
$("#tooltip").fadeIn();
},function(){
if (i==1) {
$("#tooltip").fadeOut();
i=0;
}
});
$('#tooltip').hover('',function(){
i=1;
});
HTML
<div id="background">Mouse over me.</div>
<div id="tooltip">This needs to stay visible, and not flash, until I mouse out of the green square!</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.