[csswg-drafts] [selectors] add an :ever-been-visible pseudo-class (#4015)

heycam has just created a new issue for https://github.com/w3c/csswg-drafts:

== [selectors] add an :ever-been-visible pseudo-class ==
I think it would be useful to have a declarative way to apply styles (for example for starting animations), when an element has been scrolled into view.  So this would be kind of like a declarative way to set up an intersection observer, and set a class name.  And maybe you'd want to similarly have some kind of threshold.

I've seen plenty of sites that kick off animations (maybe fading in an image, or starting a complex animation) once an element is scrolled into view.

The reason for suggesting `:ever-been-visible` rather than `:visible` is to avoid cycles if the rules that apply when the selector matches cause the element to be moved out of view.

/cc @AmeliaBR @bkardell

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4015 using your GitHub account

Received on Thursday, 6 June 2019 21:14:43 UTC