Materialize: hide the side nav on large screens

Created on 3 Nov 2016  路  3Comments  路  Source: Dogfalo/materialize

hey i wanna hide the side nav on lareg screen for example more than 992px i wanna hide it i tried to write thhis code but it doesnt work like how you did it on your website:

$(window).resize(function(){
if ($(window).width() >= 992){
// do something here

    $(".side-nav").css('transform', 'translateX(-105%)');

}

});

it doesnt work nice and smothly liek how you did it on your website how ic an achieve yours ?

question

Most helpful comment

They used media queries for this

@media only screen and(max-width:992px){
.side-nav.fixed {
-webkit-transform:translateX(-105%);
transform:translateX(-105%);
}
.side-nav.fixed.right-aligned{
-webkit-transform:translateX(105%);
transform:translateX(105%)
}
}

All 3 comments

They used media queries for this

@media only screen and(max-width:992px){
.side-nav.fixed {
-webkit-transform:translateX(-105%);
transform:translateX(-105%);
}
.side-nav.fixed.right-aligned{
-webkit-transform:translateX(105%);
transform:translateX(105%)
}
}

Why don't you use class hide-on-large-only in sidenav section instead of this

$(window).resize(function(){
if ($(window).width() >= 992){
// do something here

    $(".side-nav").css('transform', 'translateX(-105%)');

}
});

Closed due inactivity

Was this page helpful?
0 / 5 - 0 ratings