Rotate on hover using Jquery

Posted by Ian34 on Stack Overflow See other posts from Stack Overflow or by Ian34
Published on 2012-07-10T02:57:56Z Indexed on 2012/07/10 3:15 UTC
Read the original article Hit count: 117

Filed under:
|
|

I can't figure out how to set up a jquery rotate function that would only rotate on hover.

Here is the code that I am using:

$('div.settingsButton').hover(function() {
    var angle = 0;
    setInterval(function() {
        angle += 4;
        $(this).rotate(angle);
    }, 50);
},
function() {
    var angle = 0;
    setInterval(function() {
        angle = 0;
        $(this).rotate(angle);
    }, 50);
});

The rotate is a plugin found here: http://code.google.com/p/jqueryrotate/

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about hover