gpt4 book ai didi

javascript - jquery动画完成后如何淡入html?

转载 作者:行者123 更新时间:2023-12-02 16:42:54 25 4
gpt4 key购买 nike

html 立即淡入,我希望它在动画完成后淡入。这是一个旋转到屏幕顶部的图像,然后我希望其余部分淡入。我该如何让它工作?

这是我想要在动画完成后淡入的内容:

$('header, .main').fadeIn(2000);

这是完整的 jQuery:

  $( '.dimg-main' ).animate({ 
top: "-=38%",
borderSpacing: -360
},{
step: function(now) {
$(this).css('-webkit-transform','rotate('+now+'deg)');
$(this).css('-moz-transform','rotate('+now+'deg)');
$(this).css('transform','rotate('+now+'deg)');
},
duration:4000,
}),
$('header, main').fadeIn(2000);

CSS:

header, main{display: none;}

最佳答案

指定complete callback function .

$( '.dimg-main' ).animate({ 
top: "-=38%",
borderSpacing: -360
},{
step: function(now) {
$(this).css('-webkit-transform','rotate('+now+'deg)');
$(this).css('-moz-transform','rotate('+now+'deg)');
$(this).css('transform','rotate('+now+'deg)');
},
duration:4000,
complete: function(){
$('header, main').fadeIn(2000);
}
});

关于javascript - jquery动画完成后如何淡入html?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27349574/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com