这是我想要实现的目标的细分。
似乎最后一个翻译是取消第一个翻译。我还不完全确定如何正确链接。
请参阅下面的尝试:
$(document).ready(function() {
$( 'body' ).on( 'click', '.box', function() {
$( this ).css( 'transform', 'translate(0px, 200px)' );
$( this ).addClass( 'animating' );
$( this ).css( 'transform', 'translate(0px, 0px)' );
} );
} );

.box {
transform: translate(0px,0px);
width: 50px;
height: 50px;
display: block;
background: #0f0;
}
.box.animating {
transition: all 2s ease-in-out;
-webkit-transition: all 2s ease-in-out;
-moz-transition: all 2s ease-in-out;
-o-transition: all 2s ease-in-out;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="box">Hello</div>
&#13;
答案 0 :(得分:1)
这应该对你有所帮助。使用Python 2
在两个动画之间添加一个小超时
show()
&#13;
$(document).ready(function() {
$( 'body' ).on( 'click', '.box', function() {
$( this ).css( 'transform', 'translate(0px, 200px)' ).show().addClass( 'animating' ).css( 'transform', 'translate(0px, 0px)' );
} );
} );
&#13;
.box {
transform: translate(0px,0px);
width: 50px;
height: 50px;
display: block;
background: #0f0;
}
.box.animating {
transition: all 2s ease-in-out;
-webkit-transition: all 2s ease-in-out;
-moz-transition: all 2s ease-in-out;
-o-transition: all 2s ease-in-out;
}
&#13;
答案 1 :(得分:0)
请在Click Me
找到您的解决方案只需更改css:
.box {
transform: translate(0px,0px);
width: 50px;
height: 50px;
display: block;
background: #0f0;
}
.box:hover {
width: 200px;
height: 200px;
transition: all 2s ease-in-out;
-webkit-transition: all 2s ease-in-out;
-moz-transition: all 2s ease-in-out;
-o-transition: all 2s ease-in-out;
}
我希望这会对你有所帮助。
答案 2 :(得分:0)
您可以在第二个css转换中使用setTimeOut,如
$(document).ready(function() {
$( 'body' ).on( 'click', '.box', function() {
$( '.box').css( 'transform', 'translate(0px, 200px)' );
setTimeout(function(){
$( '.box' ).addClass( 'animating' );
$( '.box' ).css( 'transform', 'translate(0px, 0px)' );
}, 200);
});
});
.box {
transform: translate(0px,0px);
width: 50px;
height: 50px;
display: block;
background: #0f0;
}
.box.animating {
transition: all 2s ease-in-out;
-webkit-transition: all 2s ease-in-out;
-moz-transition: all 2s ease-in-out;
-o-transition: all 2s ease-in-out;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="box">Hello</div>
答案 3 :(得分:0)
$('.box').click(function() {
$(this).animate({
bottom: "200px"
}, 100, function() {
$(this).addClass( 'animating' );
$(this).animate({
top:"0px"
},2000);
});
} );
&#13;
.box {
transform: translate(0px,0px);
width: 50px;
height: 50px;
display: block;
background: #0f0;
position:absolute;
}
.box.animating {
transition: all 2s ease-in-out;
-webkit-transition: all 2s ease-in-out;
-moz-transition: all 2s ease-in-out;
-o-transition: all 2s ease-in-out;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<div class="box">Hello</div>
&#13;
我使用jquery animate来执行所需的动画