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

What is Framer? Join the Community
Return to index
Daniel Caine
Posted Oct 03 - Read on Facebook

Hey guys,

I ran into some issues yesterday while assigning click events in a loop. I was referred to https://framerjs.com/getstarted/programming/#scope by mamezito on Slack, and so I solved my issue using "do".

After some tinkering (no idea what I was doing lol), it actually worked. So I've begun reading further and looking into scope and closures.

I'm wondering (when you can't use 'this') which is the best approach: using 'do' or how I've done in this framer file (dunno what you'd call it): http://share.framerjs.com/bxmgg3yblzrv/

1 Comments

Floris Verloop

To help you out with this, Framer passes the clicked layer inside the event, so you can write your event inside of the for loop. You can use the clicked layer variable to set the background color. Check out this example → http://share.framerjs.com/ufokwjbcdr7d/

Read the entire post on Facebook