【发布时间】:2011-10-22 13:37:57
【问题描述】:
我有一个水平导航菜单,当用户的鼠标停留在按钮上 1 秒钟时,我想显示一个工具提示。或者换句话说,我希望提示出现的时间有所延迟。当用户将鼠标移开时,工具提示应立即消失。 Stumbleupon 的工具栏是我希望它如何发挥作用的一个示例。
javascript:
$("a.btn").hover(
function() {
var tip = $(this).parent().children(".tip-wrapper");
setTimeout(function{
tip.show();
}, 1000)
},
function {
var tip = $(this).parent().children(".tip-wrapper");
tip.hide();
}
);
html:
<th title="">
<a href="#" class="btn">
<span class="person">Firstname Lastname</span>
</a>
<div class="tip-wrapper">
<div class="tip-border">
<div class="tip">
tool tips go here
</div>
</div>
</div>
</th>
我看了很多教程,不知道为什么我的不起作用。
【问题讨论】:
标签: jquery navigation hover settimeout