Grow your CSS skills. Land your dream job.

360 spin image on hover?

  • # December 6, 2011 at 7:54 pm

    I have two gear icons, and when you hover over the div I would like for them to spin, I have it working right now using the http://code.google.com/p/jqueryrotate/ code, however, I am getting some odd results, in Firefox the rotation is off center, however, in Google Chrome, Safari and IE it works better, this is the code I am using:

    $(document).ready(function()
    {
    $('#how-it-works').hover(
    function()
    {
    $('#small-gear').rotate({animateTo:360,duration:1500})
    $('#large-gear').rotate({animateTo:-360,duration:1500})
    }, function()
    {
    $('#small-gear,#large-gear').rotate({animateTo:0})
    });
    });

    Are there any other cross-browser methods of accomplishing this? I have searched Google but I haven’t had much luck.

    # December 6, 2011 at 8:59 pm

    You can use CSS animations. Here is the browser support: http://caniuse.com/#search=CSS3%20animation

    If you want any help with them just let me know.

    # December 6, 2011 at 9:17 pm

    You can use CSS Transition for the easiest way: http://hompimpaalaihumgambreng.blogspot.com/2011/11/berbagai-efek-transisi-pada-gambar.html

    # December 6, 2011 at 9:22 pm

    I need cross-browser support though, specifically with IE.

    # December 6, 2011 at 11:10 pm

    I do not know this is support for IE or not: http://www.zachstronaut.com/posts/2009/08/07/jquery-animate-css-rotate-scale.html

    # December 6, 2011 at 11:16 pm

    Doesn’t work in IE.

    # December 6, 2011 at 11:31 pm

    Try using the CSS3PIE shim for IE. And to be honest, I don’t bother doing any fancy animations and stuff like that for old IE… just a plain ol’ layout is enough.

    # December 7, 2011 at 12:08 am

    Doesn’t look like PIE supports animations, I was hoping there would be a jQuery approach that would work well.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".