1

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?

1 Answer 1

1

Try this:

$('elementtoclick').click(function(){
   $('img').css('transform','rotate(0deg)');
})
Sign up to request clarification or add additional context in comments.

4 Comments

You are a star...Thanks a lott..Worked
One last question..How can I get the current rotation value in a variable for example I want to do this var val = 315;
For your question check this post stackoverflow.com/questions/8270612/…
I tried with the solution posted there but didn't work for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.