我有以下代码:
if (vm.theNextStep === true) {
vm.theNextStep = false;
vm.setSuccess = true;
$('#theNextStep').fadeOut(500);
$('#setSuccess').fadeIn(1500);
$('#setSuccess').fadeOut(2000);
}
#setSuccess {
padding-top: 2%;
padding-bottom: 2%;
background: #7CB130 url(check_white.png') no-repeat center;
min-height: 85px;
padding-right: 2%;
margin-bottom: 2%;
}
<div id="setSuccess" ng-show="vm.paymentSuccess"></div>
页面在淡出页面时跳转。我该如何解决?
最佳答案
页面跳转是因为你有两行代码依次运行,不等待其中一行完成。
您可以将fadeIn
代码放在第一个fadeOut
的回调中:
if (vm.theNextStep === true) {
vm.theNextStep = false;
vm.setSuccess = true;
$('#theNextStep').fadeOut(500, function(){
$('#setSuccess').fadeIn(1500).fadeOut(2000);
});
}
关于javascript - FadeIn 和 FadeOut 跳转页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35983912/