JS: element transform when it enters/exits viewport?

I want to mimic this.

Essentially, I want to create some pages with a CTA/offer a the bottom of the page, and when the user scrolls to when the CTA section is partially in the viewport, it transforms (scale in this case).

Can somebody point mein the right direction here?

It is all about checking the item’s scrollTop and comparing it to the dimensions of the viewport. Here is a stack overflow answer that shows you how to go about doing this…

Hi @jeremy58, if you don’t care about IE you can also use an intersection observer, which was introduced for exactly such purposes:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.