Search code examples
javascriptcssscrollmenufixed

CSS / Javascript Menu fixed position issue (when scrolling)


Here is my fiddle:

https://jsfiddle.net/0sawc7vL/1/

And here lies the issue:

.topmenu-ul li ul {
    font-size: 0;
    display: none;
    list-style: none;
    position: fixed;
    top: 35px;
    left: -32px;
}

The menu is perfect as it is right now. The only issue is, when I have a page where I can scroll. The submenu (with the "dashboard" link and such) stay in position, because it is fixed. When I remove the "position=fixed" property, the whole menu is screwed up. Same when I change it to relative. Any suggestions?


Solution

  • Add

    position:relative
    

    to

    nav class="nav" 
    

    element.