css3 トランジションを使用してページをアニメーション化しようとしています。要素を移動し、css3 を使用してアニメーション化できるようにする必要があります。たとえば、非表示の div を画面の外に移動し、アニメーション化して画面に戻します。奇妙に聞こえますが、説明を簡略化したので、この機能が本当に必要です。したがって、以下のコードでは、要素を 400px 左に移動し、それを 0 にアニメーション化します。アニメーションは 400px 移動せず、CSS3 トランジション クラスを追加し、0px にアニメーション化します。うまく説明できたと思います...助けてくれてありがとう。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>My test page</title>
<style type="text/css">
.box{
height:100px;
width:100px;
background-color:green;
position:absolute;
top:100px;
}
.animator{
-webkit-transition: all 1.5s ease;
-moz-transition: all 1.5s ease;
transition: all 1.5s ease;
}
</style>
<script type="text/JavaScript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.box').css({left:'400px'});
$('.box').addClass('animator');
$('.box').css({left:'0px'});
});
</script>
</head>
<body>
<div class="box">1</div>
</body>
</html>