0

So I am working on a fiddle and when I press the on the element to activate the rotation, it no longer changes scale when you hover over it. And you will notice that all of the others change scale just fine. This is what I have for the rotation.

$(C1).click(function() {
    $(C1).css("transform", "rotateY(-180deg)");
    setTimeout(function() {
        $(C1).css("transform", "rotateY(0deg)");
    });
Moox
  • 19
  • 1
  • 5

1 Answers1

0

That's because you haven't "removed" the rotation. You've set it a second time. .css() sets the inline style property which will override styles in your sylesheet because it has higher cascade weight.

You should remove the style instead with $(C1).css("transform", "");. It'll still animate the same, but it won't force rotation to 0deg.

https://jsfiddle.net/eLcgfbn3/

Edit: Honestly though, it might be better to switch over entirely to classes. It's a lot easier to keep in order with this sort of thing.

Joseph Marikle
  • 76,418
  • 17
  • 112
  • 129
  • @JosephMarikle Dude, it's off-topic, but are you currently employed? I want to start a start up business and I'm looking for partners – Kyle Mar 18 '16 at 19:45
  • 1
    @Mr.Derpinthoughton Yes, I am. You can see my info on [my careers profile](http://stackoverflow.com/jobs/cv/edit/58716). I'm also on LinkedIn, but I really should check it more often than I do. :P I'm not likely to switch jobs at this time; however, I am allowed a little flexibility with freelancing. – Joseph Marikle Mar 18 '16 at 19:49