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

What is Framer? Join the Community
Return to index
Youssef Eid
Posted Jul 12 - Read on Facebook

Hey guys, I'm having some problems with coffeescript if statements. The executable line intrepid.Header.opacity = 0 works by itself, but when I add the if statement, nothing happens. Any tips?

https://jsfiddle.net/29zg868h/1/

6 Comments

Arun Venkatesan

Share your project or at least the code where these snippets are coming from

Nathan Krischer

The simplest explanation is your if statement evaluates to false.

Youssef Eid

I've updated with a jsfiddle. Thanks guys!

Jeppe Reinhold

I'm guessing here:
When you use .next() to switch states you can pass multiple strings as you do, but I think they should be passed as an array instead of just "raw" parameters: states.next(["visible", "notVisible"]). I can see that they dont use an array in the Docs, but maybe that's an error.?

Ben Rodenhäuser

So the idea is that clicking on productLine toggles the state of timeline1 between visible and notVisible, and whenever timeline1 is visible, the opacity of intrepid.Header should go to 0. Is that correct?

Ben Rodenhäuser

If so, I think the conditional needs to be indented, so as to make it part of the event listener.

Read the entire post on Facebook