我在页眉中有一个链接 id="show"
,在页脚中有一个 div id="display"
。我想在鼠标悬停在页眉区域的 id="show"
而 div 位于页脚区域时显示 div id="display"
。
HTML 代码:
<header>
<a href="#" id="show"><span> Show Div </span></a>
</header>
<---- Other Content -->
<footer>
<div id="display"> --- Content --- </div>
</footer>
最佳答案
试试这个:您可以使用 .hover()
函数,如下所示。将逗号分隔的函数传递给它。 mouseover
时调用第一个函数,mouseleave
事件调用第二个函数。
$(function(){
$('#show').hover(function(){
$('#display').show();
},function(){
$('#display').hide();
});
}):
关于javascript - 鼠标悬停时显示div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27244578/