We would like to know how to rotate animation with CSS3 transform and jQuery.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.5.2.js'></script>
<style type='text/css'>
#box {<!--from w w w . java 2s . c o m-->
width: 100px;
height: 100px;
position: absolute;
top: 100px;
left: 100px;
text-indent: 90px;
background-color: red;
}
</style>
<script type='text/javascript'>
$(window).load(function(){
$('#box').animate({ textIndent: 0 }, {
step: function(now,fx) {
$(this).css('-webkit-transform','rotate('+now+'deg)');
},
duration:'slow'
},'linear');
});
</script>
</head>
<body>
<div id="box"></div>
</body>
</html>
The code above is rendered as follows: