-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
use <body> instead of separate wrapper div for navbar-fixed #4852
Comments
@Snewk did you try to add a wrapper div around the nav and give it the navbar-fixed class? Because this creates a separate block for the nav and sets the position for it. https://codepen.io/anon/pen/xrdjbq Generally your PR is good and moving the class to the body to toggle it easily is a good idea and an actual use case. https://codepen.io/anon/pen/eRWrNZ Can you update the docs (in the jade/page_contents directory) and change the paragraph in navbar.html, remove the wrapper div and update the wording to point at body. Thanks for the PR. This should make the component more flexible. |
@DanielRuf When testing, I tried using The first was the z-index issue which i attempted to fix with my PR, but I missed the second issue until I read your comment. In my example, there is no extra div between Also, in this case, is no way to offset the page content to a custom value. In fact, trying to adjust the height will increase the height of the body from the bottom instead of the top. I suggest leaving the navbar-fixed class as-is and closing this issue and PR. I probably should have read the documentation more carefully before submitting this as a bug. |
@Snewk your PR makes sense for special use cases. @tomscholz should we enforce our rules or give developers more freedom over this? |
@Snewk Do you mean the |
@DanielRuf Yes, i meant by changing the Here, the div gets BUT, if we use the following: The If we want to allow developers the freedom to use I would be happy to update the documentation to reflect this limitation if you decide to implement my change. |
After some more tinkering, I may have come up with a solution. instead of giving the navbar-fixed wrapper a |
@Snewk ah right. I should have tried the different offsetting solutions for fixed elements. Cool. There is always a solution ;-) Please also make the changes in the branch of your PR. |
glad to help. here is the PR |
Looks much better. @acburst @tomscholz your opinions? |
Found an issue with my PR so I closed it. Fixed it in a new PR. Here is the commit : |
@Snewk you can push new commits to your (old) branch to update your PR. |
my bad. i am still pretty new to contributing to projects i use. will make sure to do that in the future. |
@DanielRuf i agree that we need to test this change to ensure things continue working as expected. I noticed the file let me know if i can help testing or with writing a test for this component. |
Then in the version 0.100, unfortunately |
Which bug? Please be more precise, create a new issue and provide a new codepen. |
Check my issue: #4986, @DanielRuf. |
@Snewk your description of the problem "the navbar ends up covering the top of the page content" is exactly what I'm seeing (see codepen https://codepen.io/pvanheus/pen/GORrJX adapted from the one you posted). Is 15b5ff4 meant to solve this problem? |
Move the sidenav ul out of the navbar as described in #3844 |
Description
The materialize navbar handles a fixed navigation bar by creating a fixed wrapper div underneath the navbar. The extra div handles the page offset(via the height property) and z-index.
This commit moves the z-index property to the actual
.navbar-fixed nav
element itself, and handles offset usingtop
on both elementsRepro Steps
1: create a
<nav>
element.2: add
class="navbar-fixed"
to the parent element (<body>
).3: scroll down to see elements on top of the fixed navbar instead of underneath it.
4: page offset does not function in this case.
Screenshots / Codepen
https://codepen.io/anon/pen/vZmWEy

Corrected
https://codepen.io/anon/pen/Kqmypx

NOTE: this is a correction on a previous PR for the same issue.
The text was updated successfully, but these errors were encountered: