Skip to content

[selectors] add an :ever-been-visible pseudo-class #4015

@heycam

Description

@heycam

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions