我使用jQuery动画来为某些div创建动画。我有什么办法清除动画第二格之前完成第一个div的所有更改?在开始新动画之前清除所有使用jquery动画完成的更改
$(".order-b").click(function(event){
$(".order-t").animate({top:'30%'}, "slow");
});
$(".counsel-b").click(function(){
$(".counsel-t").animate({top:'30%'}, "slow");
});
<div class="process-bars">
<!-- first DIV -->
<div class="order-b">
<div class="order-t">
<i class="fa fa-shopping-cart"></i>
<h1>Order</h1>
</div>
</div>
<!-- Second DIV -->
<div class="counsel-b">
<div class="counsel-t">
<i class="fa fa-shopping-cart"></i>
<h1>Order</h1>
</div>
</div>
</div>
CSS代码:
.order-t, counsel-t {
position:absolute;
top:52%;
width: 100%;
margin:0 auto;
z-index:2;
}
我要清除的第一个div的动画,当我点击第二个div。 我该怎么做?!我不想做像下面的代码:这个答案显示
$(".order-b").click(function(event){
$(".order-t").animate({top:'30%'}, "slow");
$(".counsel-t").animate({top:'52%'}, "slow");
});
你可以在小提琴或其他东西中重现这个吗?这将有助于有你的CSS和'.counsel-t'在你的HTML? – jmore009
我编辑了代码。有一个错误 – Afshin
你可以添加你的CSS吗?为什么在第一个代码块中有点击功能,然后在第二个块中有不同的点击功能? – jmore009