-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Toolbar and Sidenav fixed in sidenav-layout #2033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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. |
Just put the md-sidenav out of layout. <md-sidenav>Fixed sidenav</md-sidenav>
<md-sidenav-layout></md-sidenav-layout> |
+1 |
@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. |
@RaulRG, just add style position fixed to the md-sidenav and toolbar will remain on the screen. |
Thank you @greg-md , but I don't understand what you mean. This is my current 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. |
@RaulRG as I said in my first comment, just pull out Example: <md-toolbar style="position:fixed;"><span>My Title</span></md-toolbar>
<md-sidenav style="position:fixed;" align="begin" mode="push" #sidenav></md-sidenav>
<md-sidenav-layout></md-sidenav-layout> PS: This is a temporary solution until material will fix in their own way. |
@RaulRG I just fixed it following the accepted answer of this stackoverflow question . Have a look. |
@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 |
@PrazSam Which version are you using? I followed that answer and it still doesn't work. I'm using ^2.0.0-beta.3 |
@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 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 Isn't there a simple setup to achieve this?
... with the Any help or pointers would be welcome. |
@axtho Is this what you're trying to do? |
i added the following css code to fix the sidenav: .mat-sidenav-container {
min-height: 100%;
max-width: 100%;
width: 100%;
height: 100vh;
}
.mat-sidenav {
min-width: 250px;
position: fixed;
top: 0;
bottom: 0;
left: 0;
padding: 0;
height: 100vh;
} |
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 |
@tstephansen What exactly you do? that the background is sticky when the sidenav is opend? |
Sidenav now supports fixed layout, docs are coming in #7775 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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.
The text was updated successfully, but these errors were encountered: