首页 文章

css:悬停旋转元素并保持新位置

提问于
浏览
0

我有一个(css?)可能旋转 element:hover 上的元素并在移动鼠标时保持新位置?

当光标离开:hover - 区域时,该元素似乎会旋转回它的默认位置 .

edit:

现在它似乎工作(忘了说,我希望它每次/多次发生):

var rotate = 360;
  $('.artistbutton360').bind({
    mouseenter: function() {
      $(this).css("-webkit-transform","rotate("+ rotate +"deg)");
      $(this).css("-moz-transform","rotate("+ rotate +"deg)");
      $(this).css("-o-transform","rotate("+ rotate +"deg)");
      $(this).css("transform","rotate("+ rotate +"deg)");
      rotate = rotate + 360;
    }
});

1 回答

  • 2

    你可以使用jquery:

    $('element').hover(function(){
      $(this).css(whatever);
    });
    

    记得加入

    $(document).ready(function(){
    
    });
    

相关问题