javascriptjquerycssresponsive-designonepage-scroll

Responsive menu for both closing and opening link one page website?


Im working on a responsive website with side menu. And now when i click on menu item the menu collapse not going to the link (#home #About).I want both closing and opening,

<div id="sidr" class="sidr left" style="display: block; left: 0px;">
<a href="#sidr-close" class="dl-trigger icon-mobile-menu dfd-sidr-close">
    <span class="icon-wrap dfd-middle-line"></span>
    <span class="icon-wrap dfd-top-line"></span>
    <span class="icon-wrap dfd-bottom-line"></span>
</a>
<div class="sidr-inner"><ul class="sidr-dropdown-menu"><li class="mega-menu-item nav-item menu-item-depth-0"><a href="#home" class="menu-link main-menu-link item-title sub-nav" role="group" aria-expanded="false" aria-hidden="true">Home</a></li>

and

e(".sub-nav").unbind("click").bind("touchend click", function(t) {
        t.preventDefault(), e.sidr("close")
    })

I used the above code. Hope i will get a correct solution.


Solution

  • Remove the t.preventDefault() in your js and it will work:

    e(".sub-nav").unbind("click").bind("touchend click", function(t) {
             e.sidr("close");
        })
    

    the prevent default is preveting your go to link behaviour.