Prithviraj Mitra
Prithviraj Mitra

Reputation: 11812

Change CSS rotation value with jQuery

I have this element in my code:

<img id="pswheel" src="images/wheel.png" style="transform: rotate(315deg); transform-origin: 50% 50% 0px;">

Now I want to change the rotation value from 315 to 0 on a click event. How do I do that?

Upvotes: 1

Views: 3151

Answers (1)

DaniP
DaniP

Reputation: 38252

Try this:

$('elementtoclick').click(function(){
   $('img').css('transform','rotate(0deg)');
})

Upvotes: 1

Related Questions