【发布时间】:2015-01-28 21:58:17
【问题描述】:
我正在构建一个包含 5 张图片的图片滑块,这些图片显示在我的网页顶部。当我在线测试时,会显示第一张图片。但它不是动画。谁能帮帮我:)
这是我的 HTML:
<div id="slider">
<figure>
<img src="http://demosthenes.info/assets/images/austin-fireworks.jpg" alt="">
<img src="http://demosthenes.info/assets/images/taj-mahal.jpg" alt="">
<img src="http://demosthenes.info/assets/images/ibiza.jpg" alt="">
<img src="http://demosthenes.info/assets/images/ankor-wat.jpg" alt="">
<img src="http://demosthenes.info/assets/images/austin-fireworks.jpg" alt="">
</figure>
</div>
这是我的 CSS:
div#slider {
display: block;
position: relative;
overflow: hidden;
-webkit-box-shadow: 0px 2px 4px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 2px 4px 0px rgba(50, 50, 50, 0.75);
box-shadow: 0px 2px 4px 0px rgba(50, 50, 50, 0.75);}
div#slider figure img {
width: 20%;
}
div#slider figure {
position: relative;
width: 500%;
margin: 0;
left: 0;
font-size: 0;
-webkit-animation: 30s slidy infinite;
-moz-animation: 30s slidy infinite;
animation: 30s slidy infinite;
}
div#slider .title{
z-index:100;
position:absolute;
color:white;
font-size: 11pt;
bottom: 0;
margin-left: 5%;
width: 90%;
}
@keyframes slidy {
20% { left: 0%; }
25% { left: -100%; }
45% { left: -100%; }
50% { left: -200%; }
70% { left: -200%; }
75% { left: -300%; }
95% { left: -300%; }
100% { left: -400%; }
}
为什么图片不向左滑动?我想让它在 iOS 和 Android 设备上运行。
【问题讨论】:
标签: html css slideshow css-animations