Hi all,
my Problem:
I've got some divs with class ".tile"
Every time you click on them, they should rotate 90 degrees (CSS3-Based)
to perform this rotation I defined the classes .rot0 (no rotation), .rot1 (90 degrees), .rot2 (180 degrees) and .rot3 (270 deg)...
The first rotation works perfectly fine, but the second not...
I already tried to use an array with the classes in it and to combine it with .hasClass... -.-
I use the following code:
- $(".rot0").click(function(){
$(this).addClass('rot1').removeClass('rot0');
});
$(".rot1").click(function(){
$(this).addClass('rot2').removeClass('rot1');
});
$(".rot2").click(function(){
$(this).addClass('rot3').removeClass('rot2');
});
$(".rot3").click(function(){
$(this).addClass('rot0').removeClass('rot3');
});
I tried to figure out what's the fault for the last half hour, but I have no idea what it could be...
I'm an "advanced beginner" in JS and jQuery, so please explain your answers ;)
Thanks already now for your answers and your patience with me ;P
P.S.: Sorry for my particular badly English...