0
So I've seen a good example on how to rotate a DIV with jQuery and CSS3 manipulation 이제는 div에서 매끄러운 호버 효과를 만들려고 노력하면서 DIV가 -15deg로 되돌아 가서 15deg로 이동해야합니다.CSS에서 DIV에서 jQuery로 회전하면 비정상적인 스냅이 발생합니다.
예를 들어 버튼을 클릭 할 때이 효과를 첨부했습니다.
"bk"를 처음 누르면 div가 스냅되고 "fwd"를 누르면 다시 나타납니다.
나는 이유를 알 수없는 것 같습니다.
.red
{
width:200px;
position:absolute;
top:50px;
left:50px;
height:200px;
background:red;
-webkit-transform: rotate(10deg);
border-spacing:0px;
}
$('#bk').click(function() {
$('.red').animate({
borderSpacing: -15
}, {
step: function(now, fx) {
$(this).css('-webkit-transform', 'rotate(' + now + 'deg)');
},
duration: 'slow'
}, 'linear');
});
$('#fwd').click(function() {
$('.red').animate({
borderSpacing: 15
}, {
step: function(now, fx) {
$(this).css('-webkit-transform', 'rotate(' + now + 'deg)');
},
duration: 'slow'
}, 'linear');
});