Materialize: #sidenav-overlay showes up above .side-nav

Created on 5 Mar 2016  路  10Comments  路  Source: Dogfalo/materialize

Hi,

the #sidenav-overlay showes up above the slide out .side-nav (see screenshot).

I'm wondering how to fix this? Is it the right way to just set the following css?

#sidenav-overlay {
    left: 240px;
}

bildschirmfoto 2016-03-05 um 16 09 08

Most helpful comment

I had the same problem, and after digging around I realized that if you put the .side-nav inside of the .navbar-fixed component the z-index for .navbar-fixed will override the one set on .side-nav. I fixed this without messing about with the css by moving the .side-nav component out of the .navbar-fixed one.

The lesson learned here is even if you aren't using the .navbar-fixed class, it might be some other parent causing your z-index to be wrong on the .side-nav.

Hope this helps!

All 10 comments

Hi @ezkay same occurs here so i just called open and close programatticaly:
$('.button-collapse').sideNav('show');
$('.button-collapse').sideNav('hide');

@ezkay overide side-overlay z index in your own css file

sidenav-overlay {

z-index: 1;

}
make sure that your css file comes after materialize own css file

That's not the best approach, modifying css is not encouraged, especially when you have other widgets on the screen such as FAB buttons.

Anyway the issue persisted even though the z-index on layover is 998 and the menu 999

z-index: 996 works perfectly

Thanks for both suggestions! The following worked for me.

sidenav-overlay {

z-index: 996;

}

I had the same problem, and after digging around I realized that if you put the .side-nav inside of the .navbar-fixed component the z-index for .navbar-fixed will override the one set on .side-nav. I fixed this without messing about with the css by moving the .side-nav component out of the .navbar-fixed one.

The lesson learned here is even if you aren't using the .navbar-fixed class, it might be some other parent causing your z-index to be wrong on the .side-nav.

Hope this helps!

@xylude's fix worked for me - far better than overriding the z-index in CSS (which didn't work in 0.98.0 anyway). This should maybe referred to in docs.

I would never recommend to change the z-index. When using the fixed navbar you have to move the mobile sidenav outside the nav sector. Anyway. This is a duplicate to https://github.com/Dogfalo/materialize/issues/3844. Please close or create a PR that fixes this issue. Thanks :)

@xylude's fix worked for me too, thx a lot! So shouldn't they update their materializer's documentation and mention this case of figure when people use the navbar or sidenav component?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

serkandurusoy picture serkandurusoy  路  3Comments

lpgeiger picture lpgeiger  路  3Comments

ReiiYuki picture ReiiYuki  路  3Comments

ruslandzhumaev picture ruslandzhumaev  路  3Comments

Robouste picture Robouste  路  3Comments