…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:
The code is way to simple for production - It’s a nice idea
You mean for the core, right? That would certainly be neat but this is not what I’m requesting. I’m wondering if anyone can make a plugin or whatever is reqired to use it
It only works because of the “trick” with top:
Ah. So, are you/they are implying that it only works for the viewport top edge then? Maybe -1 really means “one step up from viewport top” (wich is 0)… and the construct could be made dynamic?
It only woks with 1 “sticky” element atm
Ah, I think I see that when I investigate the code more closely. I don’t understand why is-pinned cannot just be a class to apply like any other (in addition to myElement) and have the js just execute (and assuming that myElement has a defined top: value).
The problem @pmario raises is that, specifically, IntersectionObserver started to work in Safari “only” 5 years ago. Are there other XXObservers, used in TW core, that are as new?