css :hover rotate element and keep the new positio

2019-09-01 10:39发布

I there a (css?) possibility to rotate an element on element:hover and keep the new position when moving the mouse out?

It seems that the element rotates back to it`s default position when the cursor leaves the :hover - area.

edit:

now it seems to work (forgot to say, that i wanted it to happen each time/ multiple times):

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楼-- · 2019-09-01 11:22

You can use jquery:

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

remember adding

$(document).ready(function(){

});
查看更多
登录 后发表回答