I am trying to animate back and forth between two css classes and I'm having some issues
right now I have two classes "contracted" and "expanded:
.button{
border: 5px #000 solid;
}
.contracted{
width:100px;
height:100px;
background-color:green;
}
.expanded {
width:200px;
height:200px;
background-color:red;
}
And im trying to switch between them with:
$( ".button" ).click(function() {
TweenMax.to(".contracted",2,{css:{className:"+=expanded"}}).set(".contracted",{delay:5,css:{className:"-=contracted"}});
TweenMax.to(".expanded",2,{css:{className:"+=contracted"}}).set(".expanded",{delay:5,css:{className:"-=expanded"}});
});
http://codepen.io/anon/pen/vzayE
And it will tween from "contracted" to "expanded"... but not vice-versa...
Is there a proper way to switch classes?