css - 出现带有 css 转换的 div 类?

标签 css animation fade transition

所以...我在旋转木马的幻灯片中有三个 div 类。 现在我有一个 display:none 用于普通元素和 display:block 用于具有 .current 类的元素,如下所示:

p.readmore,.logo,.slidetxt{
display: none;
}


.current p.readmore, .current .logo, .current .slidetxt{
display: block;
} 

它有效,但它只是“弹出”,我想淡化外观。 我还有一个标题在当前时向下移动,我也想在那个标题中设置动画或淡出。

.current h1.carousel-title{
margin-top: 200px;
} 

谢谢

最佳答案

只需将此 css 样式添加到当前类即可。我建议您使用不透明度而不是显示来切换幻灯片的显示。

.slide { opacity: 0; }

.slide.current {
    opacity: 1;
    animation-name: fadeIn;
    -webkit-animation-name: fadeIn; 
    animation-duration: 1.5s;   
    -webkit-animation-duration: 1.5s;
    animation-timing-function: ease-in-out; 
    -webkit-animation-timing-function: ease-in-out;     
    visibility: visible !important; 
}

@keyframes fadeIn {
    0% {
        transform: scale(0);
        opacity: 0.0;       
    }
    60% {
        transform: scale(1.1);  
    }
    80% {
        transform: scale(0.9);
        opacity: 1; 
    }   
    100% {
        transform: scale(1);
        opacity: 1; 
    }       
}

@-webkit-keyframes fadeIn {
    0% {
        -webkit-transform: scale(0);
        opacity: 0.0;       
    }
    60% {
        -webkit-transform: scale(1.1);
    }
    80% {
        -webkit-transform: scale(0.9);
        opacity: 1; 
    }   
    100% {
        -webkit-transform: scale(1);
        opacity: 1; 
    }       
}

关于css - 出现带有 css 转换的 div 类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18152482/

相关文章:

java - NineOldAndroids 动画不适用于 API > 10

css - 在背景 Div 上垂直居中文本

css - 如何禁用此 Div 标签?

android - 向下滑动显示textview动画

javascript - jquery图像加载()和在IE中设置超时冲突

jquery - 暂停每个淡入淡出循环

html - 将一个图像淡入另一个图像过渡

html - 在不更改 HTML 的情况下为移动和桌面 View 重新安排 flex 元素

html - 简单的 Bootstrap 站点 - 导航栏一直覆盖我的主要内容。知道为什么吗?

java声音淡出