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

What is Framer? Join the Community
Return to index
JT White
Posted Oct 21 - Read on Facebook

Hey guys, I'm sure this has come up before but I couldn't find an answer.

I'm trying to create two states for every layer in a loop, but for some reason the states are only affecting the last layer in the loop, and nothing else. Any ideas?

9 Comments

Anton Jarl

The layer divider is overwritten all the time, thats why only the last layer gets the states. You could do a new loop where you iterate through the layers and add the states but use @states.add instead. That should work. @ means "self" in this case.

Anton Jarl

But share the prototype and we can have a look!

Florian Pnn

Maybe using "do ->" will solve your problem?
http://rzrsharp.net/2011/06/27/what-does-coffeescripts-do-do.html

JT White

Anton Jarl Florian Pnn here's the prototype http://share.framerjs.com/gzy6onpyb1pa/

JT White

Anton Jarl, sorry what would I replace with @states.add??

Chris Camargo

JT White, here's what you're looking for. Just take states.add out of your for loop and place it in another for loop, where it will cycle over each sublayer of nav, and add states to each.
https://www.facebook.com/groups/framerjs/permalink/752196191574121/?comment_id=752198424907231&offset=0&total_comments=2&comment_tracking=%7B%22tn%22%3A%22R%22%7D

JT White

Chris Camargo and Anton Jarl thanks so much for your reply. Unfortunately I'm still struggling to create the new loop... Any chance you could quickly jump into my prototype and show me?http://share.framerjs.com/gzy6onpyb1pa/

JT White

Chris Camargo Anton Jarl nevermind - figured it out. Thanks for the help1!!!!!

JT White

Anton Jarl Here's the solution I came up with

Read the entire post on Facebook