Transform in jQuery

后端 未结 9 1172
野趣味
野趣味 2020-12-06 03:24

I\'m trying to get an element to animate a rotation hover effect using jquery, I have this jsFiddle going to test. So Far I have this:

$(\".icon\").hover(fun         


        
9条回答
  •  借酒劲吻你
    2020-12-06 04:17

    Probably the post is a bit outdated, but you do not need an additional plugin (this is if you do not wish to support IE 8 and below). I have sorted it out in the next way:

    1) In the CSS of the HTML define the time of transformation:

    .element {
      -webkit-transition: 0.3s;
      transition: 0.3s;
    }
    

    Then in your script do:

    $(".element").css("-webkit-transform", "rotateY(90deg)");
    $(".element").css("transform", "rotateY(90deg)");
    

    This worked for me in Chrome, Firefox and Safari, I did not test it IE, but it should work in IE9 and greater.

提交回复
热议问题