Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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;
    }
});
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
319 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can use jquery:

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

remember adding

$(document).ready(function(){

});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...