所以我熟悉css3,我一直在試圖找到一個純CSS的滑塊。我終於找到一個完全按照我在代碼筆上查找的內容,但由於某種原因,當我在localhost或jsfiddle中嘗試代碼時,它不起作用。沒有外部文件可以訪問,只要我可以在codepen中看到,並且不需要jQuery。下面我鏈接了(工作)codepen和jsfiddle。任何想法爲什麼它不會在別處工作?純CSS滑塊
HTML
<div class="slider">
<img class='photo' src="http://i.imgur.com/zMGSiyl.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/soQhb13.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/39yOaYB.jpg" alt="" />
<img class='photo' src="http://i.imgur.com/tnctKD4.jpg" alt="" />
</div>
CSS
body{background:#000;}
.slider{
margin:50px auto;
width:100%;
height:300px;
overflow:hidden;
position:relative;
}
.photo{
position:absolute;
animation:round 16s infinite;
opacity:0;
width:100%;
}
@keyframes round{
25%{opacity:1;}
40%{opacity:0;}
}
img:nth-child(4){animation-delay:0s;}
img:nth-child(3){animation-delay:4s;}
img:nth-child(2){animation-delay:8s;}
img:nth-child(1){animation-delay:12s;}
可以嘗試回答這個問題? http://stackoverflow.com/questions/41518770/anchor-tag-click-not-working-in-css-slider – uncivilized 2017-01-09 05:28:14