This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Arron J Hunt
Posted Apr 13 - Read on Facebook

It's probably staring me in the face, but how do I get the scroll position on a scroll component?

Basically I want to set up a function that will run iff the content has been scrolled past something like 300px

11 Comments

Mike Torres

I think you want pageContent.scrollY()

Arron J Hunt

Mike `TypeError: 0 is not a function (evaluating 'pageContent.scrollY()')`

I tried just pageContent.scrollY but just got zero

Ken Yiu

Try to print the page.width and page.height to check the width and height of your scroll component

Koen Bok

Drop the (): print pageContent.scrollY

Arron J Hunt

Ken Koen ah, it was working the whole time. I'm doing this in a for loop, and for some reason the .on Events.Scroll listener is *only* applying to the last page...not sure how to fix that, but my original post was a non-issue.

Arron J Hunt

Guess I need to bring the function out of the for loop?

Koen Bok

Replace line 22 with: print layer.scrollY

Benny Chew

Perhaps try pageContent.content.y or pageContent.content.scrollY

Mike Kotsch

Man, I'm getting feelings everytime I see a screenshot of code with nice styling on dark background. #art

Arron J Hunt

Koen Bok layer.scrollY is giving me undefined :(

Read the entire post on Facebook