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

What is Framer? Join the Community
Return to index
Lauren Bedal
Posted Mar 08 - Read on Facebook

Hello all,

I'm prototyping in Framer.js. I have a scroll component and scroll content, I'm trying to print the current x or scrollX position of the content. So if I scroll 500px to the right the code will print 500

Bg = new BackgroundLayer
backgroundColor: 'FFF'

scroll = new ScrollComponent
width: 750
height: 1334
scrollVertical: false

layerA = new Layer
width: 750 * 5
height: 1334
superLayer: scroll.content = "-webkit-linear-gradient(45deg, #2AF 0%, #F00 100%)"

# get current x value of scroll content
print layerA.scrollX

Framer Demo:

Codepen Demo:

Thank you in advance,


Hannes Waller

I'm not entirely sure I get what you mean, but to print the offset you could do

scroll.on Events.Scroll, (event) ->
print event.offsetX

Is that it?

Krijn Rijshouwer

Hey Lauren,

If you call the scrollX on the ScrollComponent instead of the Layer that's in the ScrollComponent it should work perfectly. I added an Event listener so it'll keep updating it when scrolling. I feel like that's what you are trying to achieve.

The solution →

Read the entire post on Facebook