November 10, 2020 01:27 am GMT
Original Link: https://davidwalsh.name/detect-sticky
How to Detect When a Sticky Element Gets Pinned
Totally agree with David, on CSS needing a selector to know if a position: sticky;
element is doing its sticky thing or not.
Ideally there would be a
:stuck
CSS directive we could use, but instead the best we can do is applying a CSS class when the element becomes sticky using a CSS trick and some JavaScript magic
I love it when there is a solution that isn’t some massive polyfill or something. In this case, a few lines … Read article “How to Detect When a Sticky Element Gets Pinned”
The post How to Detect When a Sticky Element Gets Pinned appeared first on CSS-Tricks.
You can support CSS-Tricks by being an MVP Supporter.
Original Link: https://davidwalsh.name/detect-sticky
Share this article:
Tweet
View Full Article