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

What is Framer? Join the Community
Return to index
Jérémy Jones
Posted Feb 18 - Read on Facebook

Hey guys, I have a class inside my style.css (FramerJs folder project).
I will like to apply a different class from this style.css when I "Events.Click".
I'm trying to do this but it didn't work.
Any hints?

Thanks

9 Comments

Cemre Güngör

states only support native framer properties, and within those, the ones that animate. you will have to write this manually :(

Cemre Güngör

you could do classname = Utils.cycle(['red','green']) and inside the click handler, box.className = classname()

Cemre Güngör

I typed this on a phone so no guarantees :)

Jérémy Jones

Cemre Güngör Thanks!

Cemre Güngör

basically use the cycle function to create a function that will give you either red or green each time you call it

Jérémy Jones

Cemre Güngör thanks it's works but small I have problem now
Framer:
classname = Utils.cycle(['red','green'])

myLayer = new Layer
x: 0
y: 100
width: 50
height: 50

myLayer.on Events.Click, ->
box.className = classname()
print box.className

Style.css:
.red{ background-color: red;}
.green{background-color: green;}

Butt my background-color does not change, dunno why :(

Cemre Güngör

I'm actually not sure if this is the way you assign a class

Cemre Güngör

try box._element.className ?

Jérémy Jones

ah wait...

Read the entire post on Facebook