3
This may sound simple, but I can’t find a good answer. I have an arrow icon and when I click it, I want it to turn 180 degrees. The code I started using was this:
$('.arrow').click(function() {
$('.rodar').toggleClass('rodado');
});
.rodado{
transform:rotate(180deg);
transition: all 0.3s ease-in-out;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<i class="material-icons dots green arrow rodar">keyboard_arrow_down</i>
<br>
<i class="material-icons dots green arrow rodar">keyboard_arrow_down</i>
But as you can see in the example, if I click on one, the two turn. The this
does not work. It has to do it somehow?
Thanks! Strange is that I tried to use this, but it didn’t work... it must have been some cache problem, now it worked fine, thanks!
– Gabriel Marinho
Or did you use
this
instead of turning it into a jquery object, like this$(this)
– Jorge.M
You were faster. hahaha
– fernandosavio
@fernandosavio your answer was also well prepared. + 1
– Jorge.M