You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to have to Toolbar and the sidenav fixed in my Layout so that only the content is scrolling like the angular 2 docs site: https://angular.io/docs/ts/latest/
This must somehow be possible with the sidenav-layout as many users would like to use this behavior. But i can't get it to work like this.
Plunker: http://plnkr.co/edit/SCkBpDvvWZgGCZKhWDIp?p=preview
This plunker lacks the fixed layout of the sidenavand the scrollbar on the right should only be displayed if the content height is more than the screen height.
Reacted by Dima, Martin McWhorter, Brandon Eleuterio, RaulRG, Glenn Greibesland, PrazSam, Marcus Abrahamsson, Ethan Mick, sebastianhaas, goldenbearkin and 14 more
Rather that seeing as the Toolbar and the sidenav should be fixed in the layout, I guess that the content of the sidenav-layout must be wrapped. This would allow for the expect behavior, but with so much less effort, and must be clearer what it is the intent and why this is happening. Also, I guess you can just wrap yourself the content of the sidenav-layout as a workaround. One more thing, you may want to clear the styles and just place the toolbar inside the sidenav-layout for this to work, however, it is expected to the sidenav overlap the toolbar anyway.
Reacted by Ethan Mick, goldenbearkin, Aslan Vatsaev, cuongngo, Corbin Crutchley, Arthur, Stephen Kuehl, Sven Budak, yony salgado, Rakhat Rakhmetov and 16 more
@greg-md I think this is not what @sp33dlink needs. I would like the same feature. Material Design Lite (MDL) calls it fixed header I think. The toolbar stays at the top of your page even if you need to scroll the content. With the current behaviour the toolbar scrolls out of sight if you need to scroll down to see the content.
When I open the sidenav using a button (like a hamburger menu not shown in the code above), I want the sidenav to be below the toolbar and to the left.
I tried setting the position to fixed for both the navbar and the toolbar and I don't get the desired result. When I set the position to fixed for the toolbar it disappears!!
I'm having the same issue as @RaulRG said. Toolbar just diapered when using the way @greg-md mentioned. This issue is a real headache. Hope they will fix this soon.
@cuongnm265 It's working for ^2.0.0-beta.2 which I'm currently using. Seems there is no change in their beta.3 release on it and should work. What I did was the exact same way the StackOverflow says.
I have tried to add overflow: hidden to the md-sidenav-container, but to no success.
Isn't there a simple setup to achieve this?
Looking at Covalent's layout (from the demo app) there seems nothing amazing going on, except for the main layout component they use, which has in it's scss the following:
Here's a plunk w/fixed header, a routed body, and one of the routes has a sidenav with fixed header. Be sure to check the global css file for the tweaks that made everything work:
Activity
michaeljota commentedon Dec 1, 2016
Rather that seeing as the Toolbar and the sidenav should be fixed in the layout, I guess that the content of the sidenav-layout must be wrapped. This would allow for the expect behavior, but with so much less effort, and must be clearer what it is the intent and why this is happening. Also, I guess you can just wrap yourself the content of the sidenav-layout as a workaround. One more thing, you may want to clear the styles and just place the toolbar inside the sidenav-layout for this to work, however, it is expected to the sidenav overlap the toolbar anyway.
greg-md commentedon Dec 8, 2016
Just put the md-sidenav out of layout.
RaulRG commentedon Jan 3, 2017
@greg-md I think this is not what @sp33dlink needs. I would like the same feature. Material Design Lite (MDL) calls it fixed header I think. The toolbar stays at the top of your page even if you need to scroll the content. With the current behaviour the toolbar scrolls out of sight if you need to scroll down to see the content.
greg-md commentedon Jan 3, 2017
@RaulRG, just add style position fixed to the md-sidenav and toolbar will remain on the screen.
RaulRG commentedon Jan 3, 2017
Thank you @greg-md , but I don't understand what you mean. This is my current layout:
<md-toolbar><span>My Title</span></md-toolbar><md-sidenav-layout><md-sidenav align="begin" mode="push" #sidenav></md-sidenav></md-sidenav-layout>When I open the sidenav using a button (like a hamburger menu not shown in the code above), I want the sidenav to be below the toolbar and to the left.
I tried setting the position to fixed for both the navbar and the toolbar and I don't get the desired result. When I set the position to fixed for the toolbar it disappears!!
Sorry if I didn't understand you.
greg-md commentedon Jan 3, 2017
@RaulRG as I said in my first comment, just pull out
md-sidenavfrom themd-sidenav-layoutand set fixed position to it.Example:
PS: This is a temporary solution until material will fix in their own way.
PrazSam commentedon Jan 6, 2017
I'm having the same issue as @RaulRG said. Toolbar just diapered when using the way @greg-md mentioned. This issue is a real headache. Hope they will fix this soon.
PrazSam commentedon Jan 6, 2017
@RaulRG I just fixed it following the accepted answer of this stackoverflow question . Have a look.
greg-md commentedon Jan 6, 2017
@PrazSam I don't know what is not working for both of you, maybe we misunderstood each other.
Here is an example of what I'm talking about: http://plnkr.co/edit/XfQxFVH8ZgQo0SsHCKA5?p=preview
cc @RaulRG
cuongn265 commentedon Apr 14, 2017
@PrazSam Which version are you using? I followed that answer and it still doesn't work. I'm using ^2.0.0-beta.3
PrazSam commentedon Apr 17, 2017
@cuongnm265 It's working for ^2.0.0-beta.2 which I'm currently using. Seems there is no change in their beta.3 release on it and should work. What I did was the exact same way the StackOverflow says.
axtho commentedon May 31, 2017
I also would like to know how to get that working with a similar setup as the angular site. Currently my layout is like this:
The main part of the scss for the main container (where the image is from) looks rather unimpressive:
I have tried to add
overflow: hiddento themd-sidenav-container, but to no success.Isn't there a simple setup to achieve this?
Looking at Covalent's layout (from the demo app) there seems nothing amazing going on, except for the main layout component they use, which has in it's scss the following:
... with the
overflow: hiddenbeing again the interesting part.The above plunkers do not work anymore.
Any help or pointers would be welcome.
tstephansen commentedon Jun 19, 2017
@axtho Is this what you're trying to do?
https://embed.plnkr.co/KFG66YBi3ghrFZHVLIB2/
stefanoguglielmi commentedon Jul 5, 2017
i added the following css code to fix the sidenav:
nayfin commentedon Aug 17, 2017
Here's a plunk w/fixed header, a routed body, and one of the routes has a sidenav with fixed header. Be sure to check the global css file for the tweaks that made everything work:
Not happy with setting
.mat-sidenav-contentglobally. Please let me know if you have alternative or manage to clean anything else up.SvenBudak commentedon Aug 22, 2017
@tstephansen What exactly you do? that the background is sticky when the sidenav is opend?
mmalerba commentedon Oct 13, 2017
Sidenav now supports fixed layout, docs are coming in #7775
angular-automatic-lock-bot commentedon Sep 7, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.