爲什麼我的懸停功能不起作用?隱藏div不會顯示onhover圖像
$("#staff").on("hover", function() {
$("#staffdn").show();
});
#navbar {
position: fixed;
border-style: solid;
border-color: #ffd3d9;
border-top-right-radius: 30px;
border-bottom-right-radius: 30px;
border-width: 20px;
left: -20px;
background-color: #ffd3d9;
}
#staffdn {
position: fixed;
border-style: solid;
border-color: #ffd3d9;
border-top-right-radius: 30px;
border-bottom-right-radius: 30px;
border-width: 20px;
left: 100px;
top: 100px;
background-color: #ffd3d9;
visibility: hidden;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="navbar">
<ul>
<li><a href="Home.html"><img src="Images/Nav_head/home.png"></a></li>
<li><img id="Staff" src="Images/Nav_head/fourms.png"></li>
<li><a href="Fourms.html"><img src="Images/Nav_head/fourms.png"></a></li>
<li><a href="About.html"><img src="Images/Nav_head/about.png"></a></li>
<li><a href="#"><img src="Images/Nav_head/Games.png"></a></li>
</ul>
</div>
<div id="staffdn">
<ul>
<li><img src="Staff-memebers.png"></li>
<li><img src="commands.png"></li>
</ul>
</div>
你看懸停在jQuery的文檔https://api.jquery.com/hover/ – epascarello
@Jacksont這是導致問題的可見性。 –
此外,選擇器區分大小寫([在符合標準的頁面上](http://stackoverflow.com/questions/2580029/jquery-class-selectors-like-someclass-are-case-sensitive#answer-2580031)) 。所以,'$(「#staff」)'不一定會選擇''。 – showdev