-
Notifications
You must be signed in to change notification settings - Fork 26
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
Introduce events for position sticky #34
Comments
@AurelioDeRosa couldn't you just use scroll events to check the position of the element? i know the semantics are not as pretty but that could be solved by a very small lib. |
I think that's what it does? It would make sense to have separate events if it could save some layout engine effort to do it that way. It does seem like the layout engine knows when the important points occur and global scroll/resize listeners are often inefficient. For example there is a lot going on in that audero handler, it could be throttled using requestAnimationFrame to ensure it doesn't do any wasted computations. |
Off-topic about my polyfill:
Coming back to my point, as @dmethvin stated, my main point is to improve the performance of any function that listen for the event. |
I would rather have a pseudo-class like |
I'm opening this issue to revamp an issue I already raised in the W3C position mailing list that I feel received very little attention.
The point I'm making is the following:
A use case I can think of is an element that should have the width of its parent when is not sticking and the width of the window when sticking. An example is shown in this demo I've created:
https://jsfiddle.net/638rjsty/
And this is the result I'd like to achieve:
https://jsfiddle.net/4otjrrpf/
The second demo uses a library to simulate the support for
position: sticky
, so it can be seen in any modern browser.The text was updated successfully, but these errors were encountered: