【发布时间】:2021-08-26 18:48:35
【问题描述】:
如何仅在第一次上传主页时显示启动画面,我也想要全屏移动和桌面。我正在尝试这个,但它每次上传页面时都会显示,而不是全屏显示,我的意思是在启动屏幕动画期间全屏隐藏网络浏览器 2 秒,动画是一个 svg 动画文件。这是我正在尝试的代码。
const splash = document.querySelector('.splash');
document.addEventListener('DOMContentLoaded', (e)=>{
setTimeout(()=>{
splash.classList.add('display-none');
}, 2000);
})
.splash{
position:fixed;
top:0;
left:0;
width:100%;
height:100vh;
background:#000000;
z-index:999;
color:#ffffff;
text-align:center;
line-height:90vh;
}
.splash.display-none{
position:fixed;
opacity:0;
top:0;
left:0;
width:100%;
height:100vh;
background:#000000;
z-index:-999;
color:#ffffff;
text-align:center;
line-height:90vh;
transition:all 0.5s;
}
@keyframes fadeIn{
to{
opacity:1;
}
}
.fade-in{
opacity:0;
animation:fadeIn 1s ease-in forwards;
}
<div class="splash">
<p class="fade-in">
<img src="https://2ndchance.mx/wp-content/uploads/2021/06/2ndchance-logo-animado-v1.0.0_animated-2.svg" alt="splash screen" width="200px"
</p>
</div>
【问题讨论】:
标签: javascript html css twitter-bootstrap-3