FadeOut之后的进展

时间:2014-06-11 12:58:45

标签: javascript jquery

当fadeOut完成时,我不想调用animate函数。不是在它渐渐消失的时候。我认为fadeOut中的“进度”功能是正确的。有人可以帮助我我不知道如何在我的代码上应用“进度”功能。

$(".intro").animate({height:'100%', width:'100%'}, 2000, function(){
            $(this).append("<div class='text'>Welcome to Progressbar_v1</div>"); $(".text").css({"height":"23px","width":"auto","position":"absolute","top":"0","left":"0","bottom":"0","right":"0","margin":"auto"}).animate({fontSize:'3em'},"slow");
            $(".text").fadeOut(4000);
});
$(".intro").animate({height:'30px', width:'500px'}, 2000);

2 个答案:

答案 0 :(得分:2)

使用.fadeOut()回调

$(".intro").animate({height:'100%', width:'100%'}, 2000, function(){
            $(this).append("<div class='text'>Welcome to Progressbar_v1</div>"); $(".text").css({"height":"23px","width":"auto","position":"absolute","top":"0","left":"0","bottom":"0","right":"0","margin":"auto"}).animate({fontSize:'3em'},"slow");
            $(".text").fadeOut(4000, function() {
                 $(".intro").animate({height:'30px', width:'500px'}, 2000);
            });
});

答案 1 :(得分:1)

fadeOut的第二个参数采用动画完成时执行的功能。

将代码放在那里并查看文档以获取更多信息http://api.jquery.com/fadeout/

$(".intro").animate({height:'100%', width:'100%'}, 2000, function(){
  $(this).append("<div class='text'>Welcome to Progressbar_v1</div>"); $(".text").css({"height":"23px","width":"auto","position":"absolute","top":"0","left":"0","bottom":"0","right":"0","margin":"auto"}).animate({fontSize:'3em'},"slow");
  $(".text").fadeOut(4000, function() {
    $(".intro").animate({height:'30px', width:'500px'}, 2000);
  });
});