We would like to know how to move div box 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 www .jav a 2 s . c om-->
width: 100px;
height: 100px;
position: absolute;
top: 100px;
left: 100px;
text-indent: 90px;
background-color: red;
}
</style>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$('#box').animate({ fake: 100 }, {
step: function(now,fx) {
$(this).css('-webkit-transform','translate('+now+'px)');
},
duration:'slow'
},'linear');
});//]]>
</script>
</head>
<body>
<div id="box"></div>
</body>
</html>
The code above is rendered as follows: