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?
Share your project or at least the code where these snippets are coming from
The simplest explanation is your if statement evaluates to false.
I've updated with a jsfiddle. Thanks guys!
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.?
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?
If so, I think the conditional needs to be indented, so as to make it part of the event listener.