Javascript 在jQuery中减慢location.reload()的速度?
有没有办法减慢location.reload()的速度 目前,我在一些应用中使用了Javascript 在jQuery中减慢location.reload()的速度?,javascript,show-hide,jquery,Javascript,Show Hide,Jquery,有没有办法减慢location.reload()的速度 目前,我在一些应用中使用了.toggle(“slow”),在其他应用中使用了.hide(“slow”)来显示模态动画。其中一个函数调用刷新,但动画在重新加载之前未完成。它开始了,完成了一半,然后就被切断了。我喜欢让它等到动画完成,然后重新加载 $(".modal-box button").click(function(){ $(".modal-box").hide("slow"); if ($(this).is("#rese
.toggle(“slow”)
,在其他应用中使用了.hide(“slow”)
来显示模态动画。其中一个函数调用刷新,但动画在重新加载之前未完成。它开始了,完成了一半,然后就被切断了。我喜欢让它等到动画完成,然后重新加载
$(".modal-box button").click(function(){
$(".modal-box").hide("slow");
if ($(this).is("#reset")){
location.reload();
}
});
只需将其作为动画的回调:
$(".modal-box").hide('slow', location.reload);
只需将其作为动画的回调:
$(".modal-box").hide('slow', location.reload);
相反,您应该为动画定义一个回调函数,该函数将在动画实际完成时运行
$(".modal-box button").click(function(){
var self = this; //keep the correct scope
$(".modal-box").hide("slow", function() {
if ($(self).is("#reset")){
location.reload();
}
});
});
相反,您应该为动画定义一个回调函数,该函数将在动画实际完成时运行
$(".modal-box button").click(function(){
var self = this; //keep the correct scope
$(".modal-box").hide("slow", function() {
if ($(self).is("#reset")){
location.reload();
}
});
});