2016-11-06 47 views
1

這是我在這裏的第一個問題,非常抱歉,如果措辭不正確。 我想用jQuery製作一個彈出式手機導航菜單,但是當我將錨標籤添加到我的列表項時,它們消失了。這裏的HTML:添加一個錨標籤來列出項目使列表項消失?

<nav> 
    <button id="nav-open">&#9776;</button> 
    <div id="menu"> 
     <button id="nav-close"> X </button> 
     <ul> 
      <li><a href="http://foo.com">Home</a></li> 
      <li>About</li> 
      <li>Events</li> 
      <li>Gallery</li> 
      <li>Booking</li> 
     </ul> 
    </div> 
</nav> 

這裏是JS:

$("#nav-open").click(function(event){ 
    $("#menu").show(); 
    $(this).addClass("active"); 
    event.preventDefault(); 
}); 

$("#nav-close").click(function(event){ 
    $("#menu").hide(); 
    $(this).removeClass("active"); 
    event.preventDefault(); 
}); 

當用戶點擊導航#打開移動設備上,它帶來了彈出式菜單。 (當#nav-close被點擊時,反之亦然。)我試圖添加錨標籤到列表項,但無論什麼原因,當我添加到#菜單的鏈接時,文本完全消失。

有關如何解決此問題的任何想法?

這裏是CSS:

#menu { 
    background: #000; 
    opacity: 0.95; 
    font-family: Arial Narrow; 
    text-transform: uppercase; 
    text-align: left; 
    font-weight: bold; 
    font-size: 30px; 
    margin-right: 5%; 
    height: 60px; 
    position: fixed; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 260px; 
    padding-bottom: 10px; 
    } 
+2

如果您發佈非工作代碼,而不是工作代碼這將是有益的? – adeneo

+0

像@adeneo說的 - 如果你告訴我們什麼在工作,我們不能幫你。我們需要看看哪些功能無法幫助您 – Zackh105

+0

您確定您沒有任何樣式固定的CSS,因此文本消失。 – adeneo

回答