Skip to main content

observe() Method Demos

The observe() method is the core of ScrollJs, allowing you to trigger animations when elements enter the viewport. Below are two usage examples:

1. Using Default Parameters

This demo uses observe() with its default configuration — no custom options passed.

2. Using animateOnce: true

This demo initializes ScrollObserver with the animateOnce option set to true, meaning the animation will run only once: when the elements enter the viewport.

note

This demos uses CDN Link and thus doesn't have to import the ScrollObserver() class provided by ScrollJs.

And those are live demos on how to use the observe() in your project, to play around even more e.g. customizing observer options, writing custom css animation classes, you can checkout the Playground page.