Hi Kevin, I think this has been disabled for notebooks hosted on https://observablehq.com on purpose:
You might be able to pull off something that accomplishes this with the IntersectionObserver API (?), but as far as I know doing it with CSS won’t work unless you embed the notebook on another site.
Edit: I just found this neat demo of IntersectionObserver by @mbostock: