SlickNav Fixed header causes menu not scrollable

623 Views Asked by At

I tried the solution for SlickNav fixed header here: How to make a fixed header with SlickNav

This works, but I then have a problem: my lengthy SlickNav menu list can no longer scroll, it stucks at bottom of the screen. Is there a solution?

Thank you.

Edit: My changes from original slicknav package to reproduce the problem:

1) Add to dist/slicknav.css after the line 78 (.slicknav_menu) the following lines to get fixed header:

/* change to make sticky menu */
/* but this overrides top of each page, to fix */
/* also the whole menu could no longer be scrolled!  */
/*  https://stackoverflow.com/questions/19854185/how-to-make-a-fixed-header-with-slicknav*/
  display: block;
  position: fixed;
  width: 100%;
  top: 0;

2) Add a very long menu item list to demo/index.html after Parent 2, item 7 (line 39) :

<ul id="menu">
    <li>Parent 1
        <ul>
            <li><a href="#">item 3</a></li>
            <li>Parent 3
                <ul>
                    <li><a href="#">item 8</a></li>
                    <li><a href="#">item 9</a></li>
                    <li><a href="#">item 10</a></li>
                </ul>
            </li>
            <li><a href="#">item 4</a></li>
        </ul>
    </li>
    <li><a href="#">item 1</a></li>
    <li>non-link item</li>
    <li>Parent 2
        <ul>
            <li><a href="#">item 5</a></li>
            <li><a href="#">item 6</a></li>
            <li><a href="#">item 7</a></li>
        </ul>
    </li>
    <li>Added item First</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item 1</li>
    <li>Added item Last</li>

</ul>

Now when you use mobile mode, the last item line "Added item last" cannot be seen since the menu list is to long and is no longer scrollable as it was before setting the fixed header in 1).

Incidentally by searching I found that other user had similar problem : How to make a fixed header with SlickNav

0

There are 0 best solutions below