I find css position:sticky
very useful (for exampe, I always use “sticky tiddler titles” via Ctrlpanel > Appearance > ThemeTweaks > StickyTitles
)
…but native CSS does not have a way to tell if something is stuck. However, this article gives a nifty js solution for it:
…so I humbly ask if any of the js-guys in here could somehow adapt this for TW?
With that said, a thing that concerns me is the articles’ explicit mention of the tricky usage of top: -1px in the CSS
- does this mean the stuck element must be at that position? The js has a few hard coded 1
's but I can’t tell if this has anything to do with it. Ideally the top:
position should of course be set freely.
An envisioned use case is this, i.e display something when scrolling an element into a certain position:
.myElement .popup { display:none; }
.myElement.is-pinned .popup { display:block; }