简体   繁体   English

CSS淡出徽标淡入背景页面

[英]Css fade-out logo fade-in background page

I'm trying to use the fade-out property on a home page to the #logo and at the same time fade-in to .container (whole page) . 我正在尝试使用首页上的#logo淡出属性,同时淡入.container (整个页面)。 So while the logo is fadding out, the main page it's fadding in. I'm trying with some code that I found but no success. 因此,当徽标逐渐淡出时,其主页逐渐淡入。我正在尝试使用一些我发现但没有成功的代码。 Does anyone know some proper documentation for reach it? 有人知道一些适当的文档吗? THANKS 谢谢

<div class="container">
    <div id="logo" class="animated fadeOut"></div>
</div>

.animated {
    z-index: 0;
    background-image: url(../../static/logo.svg);
    background-repeat: no-repeat;
    background-position: center;
    padding-top: 95px;
    margin-bottom: 60px; -webkit-animation-duration: 5s;
    animation-duration: 5s; -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
}
@ - webkit-keyframes fadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
@keyframes fadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}.fadeOut {
    -webkit-animation-name: fadeOut;
    animation-name: fadeOut;
}

This should work. 这应该工作。 HTML: HTML:

<div class="animated fadeIn container">
    <div id="logo" class="logo animated fadeOut"></div>
</div>

CSS: CSS:

@-webkit-keyframes fadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
.logo {
    z-index: 0;
    background-image: url(../../static/logo.svg);
    background-repeat: no-repeat;
    background-position: center;
    padding-top: 95px;
    margin-bottom: 60px;
}
.animated{
    -webkit-animation-duration: 5s;
    animation-duration: 5s;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
}


.fadeOut {
    -webkit-animation-name: fadeOut;
    animation-name: fadeOut;
}
.fadeIn {
    -webkit-animation-name: fadeOut;
    animation-name: fadeIn;
    -webkit-animation-direction: reverse; //reverse direction of animation
    animation-direction: reverse;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM