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

What is Framer? Join the Community
Return to index
Jinn Rong Wang
Posted Jun 11 - Read on Facebook

Hey Framers,
can anyone help me with "mouseover" event inside "for" loop, right now it only response to the last dot while hovering all other dots.
Check the source here(http://share.framerjs.com/7ahaxjgg69li/) if it would help, many thanks!!!

2 Comments

George Kedenburg III

dont use dot inside your event, use this or @ (like this.states.switch or @.states.switch)

Jordan Robert Dobson

By the time you mouse over the dot and the event fires... (after code is evaluated, looped, etc) dot variable will have already looped those 6 times so you want it to be relative to the layer that clicked it.

You have a few options:
1. Use @.states...
2. Use this.states...
3. Use layer.states... from the layer argument passed in
4. Use the do keyword to create a closure wrapper

For the last one go here: http://coffeescript.org/#loops and scroll down to the last example to see #4 in action.

HTH

Read the entire post on Facebook