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

What is Framer? Join the Community
Return to index
Daniel Keller
Posted Dec 11 - Read on Facebook

Next Problem.

I created a loop to create 11 layers in my prototype.

Now I want to give all 11 layers the same scrolling and dragging properties and also a unique name/id because later I need to know the x and y position of every single layer.

The code that I have right know is what I want to do and of course with this code only the latest created layer gets the scrolling properties.

I tried to include those things in the loop but I cant get it to work properly.

9 Comments

Aalok Trivedi

you have to put the draggable properties within the for loop. indent whatever properties you want for the 'layer' so it's contained in the loop and it should work http://screencast.com/t/767rAs47HBE

Daniel Keller

I tried that, but as I said I get Errors with it :(

Exact Error: TypeError: undefinied is not an object (evaluating this.draggable.enable = true)

Aalok Trivedi

defining layer properties don't take 'this' dot notation syntax. you can only do that for events/functions/etc (i believe?). You indented too far and you have to use the layer name

Daniel Keller

Thats the thing, layer.draggable.enable = true does also not work. And I cant find out how to give every single layer a unique name in the loop :)

Aalok Trivedi

look at the example. your draggable/scroll properties can't go in the layer properties. http://share.framerjs.com/k1drsxdygk9w/

Daniel Keller

Aalok THANK YOU SO MUCH :) It works perfect. I thought I even tried that but I probably was in the wrong scope (im not used to the white space type of programming :D (bad excuse).

Daniel Keller

Also the naming works :) really cool! :)

Andrew Liebchen

For the unique values, maybe create a simple array or an array of objects, the loop through that. Each element in the array would correspond to one of the layers you want to create, and could hold the unique properties. https://medium.com/framer-prototyping/code-less-achieve-more-with-arrays-in-framer-c43594d13d59#.97e0kwkpm

Read the entire post on Facebook