Javascript 在显示另一个元素时隐藏一个元素?
我需要一种方法来隐藏一个元素(Javascript 在显示另一个元素时隐藏一个元素?,javascript,jquery,css,Javascript,Jquery,Css,我需要一种方法来隐藏一个元素(.close按钮),同时显示另一个元素(#加载动画)。如何在jQuery中使用条件实现这一点 比如: while ($('#loading-animation').show(100);) { $('.close-button').hide(); } 显然,这不起作用,但如何正确设置格式?使用show([duration][,complete])的完整回调 所有jQuery动画都有一个完整的回调选项 参考:使用show的完整回调([duration][,co
.close按钮
),同时显示另一个元素(#加载动画
)。如何在jQuery中使用条件实现这一点
比如:
while ($('#loading-animation').show(100);) {
$('.close-button').hide();
}
显然,这不起作用,但如何正确设置格式?使用
show([duration][,complete])的完整回调
所有jQuery动画都有一个完整的回调选项
参考:使用show的完整回调([duration][,complete])
所有jQuery动画都有一个完整的回调选项
参考:使用show的完整回调([duration][,complete])
所有jQuery动画都有一个完整的回调选项
参考:使用show的完整回调([duration][,complete])
所有jQuery动画都有一个完整的回调选项
参考:如果使用CSS执行动画(例如CSS转换)
然后,您可以使用以下命令监视转换结束事件:
$('.close-button').hide();
$("#loading-animation").bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(event){
//this will run when the css transitions on your #loading-animation end
$('.close-button').show();
}).show();
也可以使用jQuery animate执行动画:
$('.close-button').hide();
$("#loading-animation").animate({
//do your transitions here
//"left":"+=200"
}).promise().done(function(){
//this will run when animate is done
$('.close-button').show();
});
如果使用CSS执行动画(例如,CSS转换)
然后,您可以使用以下命令监视转换结束事件:
$('.close-button').hide();
$("#loading-animation").bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(event){
//this will run when the css transitions on your #loading-animation end
$('.close-button').show();
}).show();
也可以使用jQuery animate执行动画:
$('.close-button').hide();
$("#loading-animation").animate({
//do your transitions here
//"left":"+=200"
}).promise().done(function(){
//this will run when animate is done
$('.close-button').show();
});
如果使用CSS执行动画(例如,CSS转换)
然后,您可以使用以下命令监视转换结束事件:
$('.close-button').hide();
$("#loading-animation").bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(event){
//this will run when the css transitions on your #loading-animation end
$('.close-button').show();
}).show();
也可以使用jQuery animate执行动画:
$('.close-button').hide();
$("#loading-animation").animate({
//do your transitions here
//"left":"+=200"
}).promise().done(function(){
//this will run when animate is done
$('.close-button').show();
});
如果使用CSS执行动画(例如,CSS转换)
然后,您可以使用以下命令监视转换结束事件:
$('.close-button').hide();
$("#loading-animation").bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(event){
//this will run when the css transitions on your #loading-animation end
$('.close-button').show();
}).show();
也可以使用jQuery animate执行动画:
$('.close-button').hide();
$("#loading-animation").animate({
//do your transitions here
//"left":"+=200"
}).promise().done(function(){
//this will run when animate is done
$('.close-button').show();
});
你的动画,是用css还是js完成的?你的动画,是用css还是js完成的?你的动画,是用css还是js完成的?你的动画,是用css还是js完成的?