CSS幻灯片,切换图片时,2张图片有一部分出现重叠。
HTML
<div class = "middle">
<div class="slide" id="slide_1"></div>
<div class="slide" id="slide_2"></div>
</div>
CSS
.middle{
width: 100%;
min-height: 100%;
}
.slide{
position: absolute;
top: 0;
left: 0;
width: 100%;
min-height: 100%;
-webkit-animation: slide 10s linear infinite 0s;
}
#slide_1.slide{
background: url(http://img14.poco.cn/mypoco/myphoto/20130216/12/64413070201302161217254259868514155_005.jpg) no-repeat center center;
}
#slide_2.slide{
background: url(http://www.fansimg.com/album/uploads2012/10/userid368748time20121018140423.jpg) no-repeat center center;
-webkit-animation-delay: 5s;
-webkit-transform: translatex(100%);
}
@-webkit-keyframes slide{
0%{
-webkit-transform: translatex(100%);
}
10%{
-webkit-transform: translatex(0%);
}
50%{
-webkit-transform: translatex(0%);
}
60%{
-webkit-transform: translatex(-100%);
}
100%{
-webkit-transform: translatex(-100%);
}
}
hillman
9 years, 1 month ago