栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

CSS中的多个图像交叉淡入淡出-无需(java)脚本

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

CSS中的多个图像交叉淡入淡出-无需(java)脚本

如果您知道有多少张图片,可以使用CSS3轻松完成。

#crossfade > img {     width: 100%;    height: 100%;    position: absolute;    top: 0px;    left: 0px;    color: transparent;    opacity: 0;    z-index: 0;    -webkit-backface-visibility: hidden;    -webkit-animation: imageAnimation 30s linear infinite 0s;    -moz-animation: imageAnimation 30s linear infinite 0s;    -o-animation: imageAnimation 30s linear infinite 0s;    -ms-animation: imageAnimation 30s linear infinite 0s;    animation: imageAnimation 30s linear infinite 0s; }

-webkit-animation:imageAnimation 30s 线性 无限 0s; ”处的“ 30s”
表明,每个图像的动画将无限次持续30秒。

#crossfade > img:nth-child(2)  {     background-image: url(../images/2.jpg);    -webkit-animation-delay: 6s;    -moz-animation-delay: 6s;    -o-animation-delay: 6s;    -ms-animation-delay: 6s;    animation-delay: 6s; }#crossfade > img:nth-child(3) {     background-image: url(../images/3.jpg);    -webkit-animation-delay: 12s;    -moz-animation-delay: 12s;    -o-animation-delay: 12s;    -ms-animation-delay: 12s;    animation-delay: 12s; }#crossfade > img:nth-child(4) {     background-image: url(../images/4.jpg);    -webkit-animation-delay: 18s;    -moz-animation-delay: 18s;    -o-animation-delay: 18s;    -ms-animation-delay: 18s;    animation-delay: 18s; }#crossfade > img:nth-child(5) {     background-image: url(../images/5.jpg);    -webkit-animation-delay: 24s;    -moz-animation-delay: 24s;    -o-animation-delay: 24s;    -ms-animation-delay: 24s;    animation-delay: 24s; }@-webkit-keyframes imageAnimation {     0% { opacity: 0;    -webkit-animation-timing-function: ease-in; }    8% { opacity: 1;         -webkit-animation-timing-function: ease-out; }    17% { opacity: 1 }    25% { opacity: 0 }    100% { opacity: 0 }}@-moz-keyframes imageAnimation {     0% { opacity: 0;    -moz-animation-timing-function: ease-in; }    8% { opacity: 1;         -moz-animation-timing-function: ease-out; }    17% { opacity: 1 }    25% { opacity: 0 }    100% { opacity: 0 }}@-o-keyframes imageAnimation {     0% { opacity: 0;    -o-animation-timing-function: ease-in; }    8% { opacity: 1;         -o-animation-timing-function: ease-out; }    17% { opacity: 1 }    25% { opacity: 0 }    100% { opacity: 0 }}@-ms-keyframes imageAnimation {     0% { opacity: 0;    -ms-animation-timing-function: ease-in; }    8% { opacity: 1;         -ms-animation-timing-function: ease-out; }    17% { opacity: 1 }    25% { opacity: 0 }    100% { opacity: 0 }}@keyframes imageAnimation {     0% { opacity: 0;    animation-timing-function: ease-in; }    8% { opacity: 1;         animation-timing-function: ease-out; }    17% { opacity: 1 }    25% { opacity: 0 }    100% { opacity: 0 }}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/575722.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号