Re: [csswg-drafts] [css-selectors] :stuck pseudo-class feature suggestion

@zipper `position:sticky` provides more than just swapping to `position:fixed` if you were running tabs on a scroll event. It also works within internal scrolling nodes, so you'd have to swap to `position:absolute` AND make sure the sticky-like element's offsetParent was the outer element of the node that is scrolling. It also behaves 'fixed' in one axis, unlike actual `position:fixed` fixing to a root context in both scrolling directions. So if you need to change something about the stuck element when it's stuck, yes JS is needed, otherwise it's out of scope of what `position:sticky` at least offers.

PS Even using the boundingClientRect of a sentinel element alongside the boundingClientRect of a sticky element is simpler and more foolproof than running JS to swap in `position:fixed`.

-- 
GitHub Notification of comment by jonjohnjohnson
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1656#issuecomment-373464934 using your GitHub account

Received on Thursday, 15 March 2018 17:47:30 UTC