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

What is Framer? Join the Community
Return to index
Giles Perry
Posted May 31 - Read on Facebook

Just getting started with Framer JS. I've got some questions about how you control positioning of layers. I've worked out how to create a left aligned layer that is fixed when the rest of the page scrolls:

myLayer = new Layer({x:0, y:0, width:40, height:40, image:"images/fixedimage.png"})

// Set the CSS position property to fixed so the layer does not scroll
myLayer.style = {
"position":"fixed",
}

How do you create centre and right aligned layers?

1 Comments

Giles Perry

I've worked out right aligning

leftLayer.style = {
"position":"fixed",
"left": "0",
}

rightLayer.style = {
"position":"fixed",
"right": "0",
}

This approach doesn't work for centre aligning layers because Framer layers are absolutely positioned.

I can centre the layer initially:

centreLayer.centerX()

Do I need to use javascript to apply this function every time the window is resized? How is this done.

Thanks for any help.

Read the entire post on Facebook