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

What is Framer? Join the Community
Return to index
Alex Lingeman
Posted Apr 07 - Read on Facebook

Hi guys,

I've got a layer with the y:500 property and I've made it draggable. But when you drag, I don't want it to be dragged higher than 500.

Is there a minimal and max x/y position you can drag a layer to, and how do you specify this ?

Keep up the good work !

4 Comments

Nils Hoenson

Hey Alex Lingeman, you can do this by using a simple if-statement. If the y-value of the layer is bigger than 500, then make the layer undraggable & change the y-value to the max range (500 in this case). Hope this helps!

http://share.framerjs.com/jmq27w7rcgbs/

Marc Krenn

Even though I'd strongly(!) recommend doing it the way Nils explained above, there's an undocumented function called "layer.maxDragFrame" which allows you to set hard boundaries for draggable layers. However, I'm not 100% sure if this function is still ... well, functioning.

Example: http://examples.framerjs.com/#draggable-swipe.framer
Blog post: http://framerjs.tumblr.com/post/93327177827/draggable-swipe-by-benjamin-nathan-people-often

Alex Lingeman

Thank you Nils Hoenson and Marc Krenn for your solutions. I've implemented Nils's solution, and it seems to work just fine !

Alex Lingeman

Also, the final result. The new scroll features came a few days later, so i'm going to fit that in soon :) https://dribbble.com/shots/2003566-NGC-Interactive-Article-preview?list=users&offset=0

Read the entire post on Facebook