visible()
functionsince 0.1requires runtime1 while at least the threshold of the element intersects the viewport, else 0.
On this page · 8 sections+−
Syntax
visible(<threshold>?)registry syntax: visible([threshold])
Parameters
- threshold
<number>from 0 to 1optional - Default 0.
Return value
1 or 0. 0 until the first observation.
Example
reveal.cssreactive
.card { opacity: calc(0.2 + visible(0.3) * 0.8); transition: opacity 400ms;}visible()Function · hover any red token1 while at least the threshold of the element intersects the viewport, else 0.Reference →
Behavior
- One shared
IntersectionObserverper threshold.
Supported contexts
- Any value.
Limitations
- For scroll progress rather than a visible/hidden state, use native scroll-driven animations.
Related
Experimental · syntax may change between minor versions