Skip to content
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

Toolbar fixed instead of sticky? #148

Open
kCenk opened this issue Feb 23, 2015 · 13 comments
Open

Toolbar fixed instead of sticky? #148

kCenk opened this issue Feb 23, 2015 · 13 comments
Milestone

Comments

@kCenk
Copy link
Contributor

kCenk commented Feb 23, 2015

Is there a way to make the Toolbar fixed instead of sticky, without breaking the sidebar & stuff?

@nt1m
Copy link
Owner

nt1m commented Feb 23, 2015

Why ? position: sticky; simplifies things a lot

@kCenk
Copy link
Contributor Author

kCenk commented Feb 24, 2015

Yeah but http://caniuse.com/#feat=css-sticky the compatibility of this is really crappy.

@nt1m
Copy link
Owner

nt1m commented Feb 24, 2015

@kCenk Just tried position: fixed, and it needs lots of bug fixes unfortunately. I don't have much time to fix this, but feel free to :)

@nt1m nt1m modified the milestone: Priority 2 Feb 24, 2015
@kCenk
Copy link
Contributor Author

kCenk commented Feb 24, 2015

The reason i use frameworks specially CSS based ones is my CSS Skills are crappy :) Could try to fix it with JS :)

@nt1m
Copy link
Owner

nt1m commented Feb 24, 2015

@kCenk Let's not use JS for these kinds of issues ;)
This is actually kinda tricky with position: fixed. If I use position: fixed, I have to make use of another experimental CSS technology : width: -moz-available; . Support for that is limited to chrome and Firefox.
width: 100% doesn't work, since with position:fixed, widths are relative to the viewport.

One other solution though, is to wrap all contents under the header, remove position: sticky, and use flexbox so the header stays fixed. This solution is cross browser, but I hate using too much elements.

The header styles aren't part of the framework anyway (although they should be), they are part of the demo.css file.

@kCenk
Copy link
Contributor Author

kCenk commented Feb 24, 2015

I see, well i needed it to be fixed cause i make a header show/hide toggle that works like the one in Android. Where you scroll down in a document and the moment you scroll up again the header slides down.

@nt1m
Copy link
Owner

nt1m commented Feb 24, 2015

@kCenk If your header takes the full viewport width (that's usually the case for android apps), you can simply use position: fixed; width: 100%; on .header, then add 50px top padding on the content.

@nt1m
Copy link
Owner

nt1m commented Feb 24, 2015

Oh, wait, so you also need the header to show when the users scrolls back up, that isn't possible without JS, even position: sticky doesn't provide that.

@kCenk
Copy link
Contributor Author

kCenk commented Feb 24, 2015

Yeah i have the JS part ready.

@nt1m
Copy link
Owner

nt1m commented Feb 24, 2015

@kCenk My suggestion from my previous comment should work if the header takes the the full width of the screen then.
I should fix this bug anyway, but probably not in the short term. This framework isn't really my top priority :/ So you can try my workaround for now :)

@kCenk
Copy link
Contributor Author

kCenk commented Feb 24, 2015

Should i drop the module as a commit to materialize.js?

@nt1m
Copy link
Owner

nt1m commented Feb 24, 2015

@kCenk Sure :)

@locness3
Copy link

locness3 commented Dec 9, 2019

Most modern browsers support sticky now - most problems are related to tables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants