Visibility
Visibility provides a set of callbacks for when a content appears in the viewport.

Types

Default

An example of Visibility.

CalculationValue
directionnone
pixelsPassed0px
percentagePassed0%
fitsfalse
width0px
height0px
onScreenfalse
offScreenfalse
passingfalse
topVisiblefalse
bottomVisiblefalse
topPassedfalse
bottomPassedfalse

Settings

Fire on mount

Fires callbacks immediately after mount.

CalculationValue
directionup
pixelsPassed0px
percentagePassed0%
fitsfalse
width950px
height76px
onScreenfalse
offScreentrue
passingfalse
topVisiblefalse
bottomVisiblefalse
topPassedfalse
bottomPassedfalse

Offset

Value that context should be adjusted in pixels. Useful for making content appear below content fixed to the page.

CalculationValue
topVisiblefalse
bottomVisiblefalse
topPassedfalse
bottomPassedfalse

Callback frequency

You can change the callback frequency with `once` and `continuous` settings.

Event Log
0

Grouped callbacks

You can specify callbacks that occur after different percentages or pixels of an element are passed.

Event Log
0

Update on

You can specify updateOn='repaint', it will allow to update and fire callbacks on browser repaint (animation frames).

By default Visibility handles events only on browser events. It means that if you will hide a large block an event will not be triggered and Visibility will not perform calculations. This problem can be easily solved with updateOn='repaint'.
It's a tricky Segment
CalculationValue
topVisiblefalse
bottomVisiblefalse
This is the bottom
Blazing deployments by Vercel.