Today, I debugged a static webpage with jQuery and native JS, and used IntersectionObserver API to monitor whether elements appear in viewports when making animations. However, I found that compatibility was very poor:

For compatibility query, visit www.caniuse.com

But a warehouse was found to solve the problem.

The repository is provided by THE W3C with IntersectionObserver compatible scripts

Download:

npm i intersection-observer -S
Copy the code

Use:

(after)