[英]How to change color of div after first transition
Here is my Code. 这是我的代码。 Initially Div color is black I want it to be changed after div totally has been slided towards right but it changes instantly when i click go button. 最初,div颜色是黑色的,我希望在div完全向右滑动后进行更改,但是当我单击“转到”按钮时,它会立即更改。 Solution please ... 解决方案请...
$("#go").click(function () {
$("#subdiv").animate({ "left": "+=75%" }, 1500);
$('#subdiv').css("background-color", "#293955");
$("#subdiv").animate({ "left": "-=75%" }, 1500);
}
);
use a callback for the animation that manipulates the element only after the animation has finished : 为动画使用回调,仅在动画完成后才操纵元素:
$("#go").click(function () {
$("#subdiv").animate({ "left": "+=75%" }, 1500,function(){
$('#subdiv')
.css("background-color", "#293955")
.animate({ "left": "-=75%" }, 1500);
}
);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.