2017-04-14 59 views
0

我一直在做我的新網站,我只是有一個問題,找到正確的功能打開我的隱藏div的響應菜單。響應菜單隱藏覆蓋div不顯示onclick

這裏是我的代碼:https://codepen.io/anon/pen/XRJRGE

<a class="page-head__menu" id="js-menu" href="#"   onClick="open()">Menu</a> 

    <script> U = function(t) { 
    M.setAttribute("data-state", "visible" === M.getAttribute("data-state") ?  "hidden" : "visible"), this.setAttribute("data-state", "open" === this.getAttribute("data-state") ? "closed" : "open"), 
"open" === this.getAttribute("data-state") && O ? (A(k, "white"), A(C, "white")) : O && (E(k, "white"), E(C, "white")), 
    "open" === this.getAttribute("data-state") ? clearInterval($): "/" === e.location.pathname && s(), t.preventDefault() 
} </script> 

<div id="js-overlay" > 
     <ul class="menu-nav"> 
    <li class="sel"> <a href="/portfolio">Portfolio</a> 
    <script>var Z = function(e) { 
    var t = this.getAttribute("href"); 
    N.innerHTML = "", M && (M.setAttribute("data-state", "hidden"), D.setAttribute("data-state", "open")), w(t), a(t), e.preventDefault() 
} </script> 

    </li> 
    <li class="sel"> <a href="/about">About &amp; Contact</a> 
    </li> 
</ul> 
<div class="content"> </div>  
<div class="menu-social"> 
    <a href="https://facebook.com/bojanaknezevicart" class="page-social__facebook js-social-icon">Facebook</a> 
    <a href="http://instagram.com/" class="page-social__instagram js-social-icon">Instagram</a> 
    <a href="https://www.behance.net/" class="page-social__behance js-social-icon">Behance</a> 
    <a href="http://dribbble.com/" class="page-social__dribbble js-social-icon hide-header">Dribbble</a> 
</div></div> </div> 

A碼是巨大的,因爲我張貼在上面流動,我的問題的鏈接。

需要是這樣的:enter image description here

回答

1

更改open函數名稱到別的東西,做這個

document.getElementById("js-overlay").style.display = "block" 

該函數內部。
因爲Windows對象中已經有一個函數open

+0

非常感謝你,現在它工作! – Bojana