HTML, 點擊切換動態效果

來源:互聯網
上載者:User

標籤:ase   ack   utf-8   設定   jpg   效果   absolute   class   display   

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
.div1{
height: 350px;
/*/!*background: red;*!/*/
/*float: left;*/
margin-top:60px;
margin-left: -2px;
position: absolute;
border-radius:5px;
margin-bottom: 60px;
}
#frame {/*----------圖片輪播相框容器----------*/

position: absolute; /*--絕對位置,方便子項目的定位*/
width: 960px;
height: 350px;
overflow: hidden;/*--相框作用,只顯示一個圖片---*/
border-radius:5px;
border: 1px solid; margin-top:50px ;
}

#photos img {
float: left;
width:960px;
height:350px;
}
#photos {
/*---設定總的圖片寬度--通過位移來達到輪播效果----*/
position: absolute;
/*z-index:9;*/
width: calc(960px * 5);/*---修改圖片數量的話需要修改下面的動畫參數*/
}
.play{

animation: ma 5s ease-out infinite alternate;
}
/*@keyframes ma {/!*---每圖片切換有兩個階段:位移切換和靜置。*/
/*中間的效果可以任意定製----*!/*/ /!*不注釋 即 自動播放*!/
/*0%,20% { margin-left: 0; }*/
/*25%,40% { margin-left: -960px; }*/
/*45%,60% { margin-left: -1920px; }*/
/*65%,80% { margin-left: -2880px; }*/
/*85%,100% { margin-left: -3840px; }*/
/*}*/
.num{
position:absolute;
z-index:10;
/*display:inline-block;*/
float: left;
right:10px;
top:295px;
border-radius:100%;
background:#f00;
width:25px;
height:25px;
line-height:25px;
cursor:pointer;
color:#fff;
text-align:center;
opacity:0.8;
}
.num:hover{background:#00f;}
.num:hover,#photos:hover{
animation-play-state:paused;
}
.num:nth-child(2){
margin-right:30px
}
.num:nth-child(3){
margin-right:60px
}
.num:nth-child(4){margin-right:90px}
.num:nth-child(5){margin-right:120px}
#a1:hover ~ #photos{animation: ma1 .5s ease-out forwards;}
#a2:hover ~ #photos{animation: ma2 .5s ease-out forwards;}
#a3:hover ~ #photos{animation: ma3 .5s ease-out forwards;}
#a4:hover ~ #photos{animation: ma4 .5s ease-out forwards;}
#a5:hover ~ #photos {animation: ma5 .5s ease-out forwards;}
@keyframes ma1 {0%{margin-left:-4800px;}
100%{margin-left:-0px;} }
@keyframes ma2 {0%{margin-left:-4800px;}
100%{margin-left:-960px;} }
@keyframes ma3 {100%{margin-left:-2880px;} }
@keyframes ma4 {100%{margin-left:-3840px;} }
@keyframes ma5 {100%{margin-left:-3840px;} }
#dis {/*--絕對位置方便li圖片簡介的自動分布定位---*/
position: absolute;
left: -50px;
top: 0;
opacity: 0.5;
}
#dis li {
display: inline-block;
width: 200px;
height: 20px;
/*margin: 0 50px;*/
margin-left: 768px;
float: left;
text-align: center;
color: #fff;
border-radius: 10px;
background: #000;
}
</style>
</head>
<body>
<div class="grid_24 div1">
<div id="frame" >
<a id="a1" class="num">1</a>
<a id="a2" class="num">2</a>
<a id="a3" class="num">3</a>
<a id="a4" class="num">4</a>
<a id="a5" class="num">5</a>
<div id="photos" class="play">
<a href=""> <img src="image/1.jpg" > </a>
<a href=""> <img src="image/15.jpg" ></a>
<a href=""> <img src="image/6.jpg" ></a>
<a href=""> <img src="image/9.jpg" ></a>
<a href=""> <img src="image/13.jpg" ></a>
<ul id="dis">
<li>燃燒海王</li>
<li> 激情時刻 </li>
<li>路飛與超新星</li>
<li>翻外篇</li>
</ul>
</div>
</div>
</div>
</body>
</html>

HTML, 點擊切換動態效果

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.