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

What is Framer? Join the Community
Return to index
Leonard Burton
Posted Aug 17 - Read on Facebook

Hi Everyone. I'm having a problem that's driving me crazy! Can anyone tell me why if I add pages to a PageComponent using a For loop I am missing my last layer if I set the x and parent properties, but if I use the addPage function it's fine?

Quick examples:
Fine:
http://prototyp.in/#!/interaction/-KriHrno7iW4v9AaiCbq/edit

Broken:
http://prototyp.in/#!/interaction/-KriI7bYJtMm-WKde9gD/edit

3 Comments

Leonard Burton

It looks like the missing card is there... it's just being cropped out or something.

Derek Nguyen

I think PageComponent automatically adjust the size of `content` layer when you add or remove child to it. So you want to change the `x` property of your page before you add it to page.content. Instead of:

vdSlider[i].parent = sliderA.content
vdSlider[i].x = (vdSlider[i].width*i) + (vdSliderSettings.spacing*i)

do
vdSlider[i].x = (vdSlider[i].width*i) + (vdSliderSettings.spacing*i)
vdSlider[i].parent = sliderA.content

Leonard Burton

Amazing! Thank you so much, I was starting to lose the plot with that one. I knew it would be something really simple like that but until I you said it I was clueless.

Thanks for the fix and the insight. I'm using FramerJS properly for the first time so it was really frustrating to be stalled with this so early on. You rule Derek Nguyen!

Read the entire post on Facebook