亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

CSS3+JavaScript實(shí)現(xiàn)翻頁(yè)幻燈片效果

 更新時(shí)間:2017年06月28日 09:02:08   作者:當(dāng)年華褪去生澀  
這篇文章主要介紹了CSS3+JavaScript實(shí)現(xiàn)翻頁(yè)幻燈片效果,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下

先上效果圖

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title></title>
    <style type="text/css">
      *{
        margin: 0;
        padding: 0;
      }
      #content{
        width: 500px;
        height: 300px;
        margin: 40px auto;
        position: relative;
        transform-style: preserve-3d;
      }
      #content>div{
        width: 100%;
        height: 100%;
        position: absolute;
        transform-origin: center bottom;
      }
      #content img{
        width: 100%;
        height: 100%;
      }
      #next{
        position: absolute;
        top:190px;
        left: calc(33% - 60px);
      }
      #prev{
        position: absolute;
        top: 190px;
        left: calc(68% + 30px);
      }
      @keyframes next{  //創(chuàng)建一個(gè)動(dòng)畫(huà)這是一個(gè)翻到下面的效果
        from{
          -wbelit-transform: perspective(1000px) rotateX(0deg); /* 開(kāi)始位置是 0°*/
          opacity: 1; //初始透明為1
        }
        to{
          -webkit-transform: perspective(1000px) rotateX(-180deg); /*結(jié)束位置是 180°*/
          opacity: 0; //結(jié)束透明為0
        }
      }
      @keyframes prev{ //創(chuàng)建一個(gè)由上邊翻到上邊的動(dòng)畫(huà)
        0%{
          -webkit-transform: perspective(1000px) rotateX(180deg); /* 初始開(kāi)始位置 */
          opacity:0;    //初始為透明
        }
        57%
        {
          -webkit-transform: perspective(1000px) rotateX(-16deg); /* 動(dòng)畫(huà)進(jìn)行到 56% 的時(shí)候他為 -16° */
          opacity:1; //透明已經(jīng)為1 了
        }
        66%
        {
          -webkit-transform: perspective(1000px) rotateX(14deg); /* 再回到 14° 的位置 */
        }
        74%
        {
          -webkit-transform: perspective(1000px) rotateX(-12deg); /* 再回到 -12°的位置 */
        }
        81%
        {
          -webkit-transform: perspective(1000px) rotateX(10deg); /* 再回到 10°的位置 */
        }
        87%
        {
          -webkit-transform: perspective(1000px) rotateX(-8deg); /* 再回到 -8°的位置 */
        }
        92%
        {
          -webkit-transform: perspective(1000px) rotateX(6deg); /* 再回到 6° 的位置 */
        }
        96%
        {
          -webkit-transform: perspective(1000px) rotateX(-4deg); /* 再回到 -4° 的位置 */
        }
        100%
        {
          -webkit-transform: perspective(1000px) rotateX(0deg); /* 最后回歸 0° */
        }<br>                                        
      }
      .next{
        animation: next 1s ease 1 normal 0s; /* 執(zhí)行向下的動(dòng)畫(huà) */
        transform: rotateX(-180deg); /* 因?yàn)槌跏嘉恢檬? 但當(dāng)你執(zhí)行完動(dòng)畫(huà)還會(huì)回到原位 所以它轉(zhuǎn)到哪里就把他設(shè)在哪里不要再讓它回去了 */
        opacity: 0;
      }
      .prev{
        animation: prev 1.2s ease 1 normal 0s; /* 執(zhí)行向上的動(dòng)畫(huà) */
        transform: rotateX(0deg); /* 同上 */
        opacity: 1;
      }
    </style>
  </head>
  <body>
    <button id="next">←</button><button id="prev">→</button>
    <div id="content">
      <div class="prev"><img src="images/012.jpeg"></div> <!-- 設(shè)置默認(rèn)的第一頁(yè) -->
      <div class="next"><img src="images/017.jpeg"></div>
      <div class="next"><img src="images/020.jpeg"></div>
      <div class="next"><img src="images/027.jpeg"></div>
      <div class="next"><img src="images/0df3d7ca7bcb0a46ce09bc1e6e63f6246b60afe9.jpg"></div>
    </div>
    <script>
      window.onload=function(){
        var next=document.getElementById("next");
        var prev=document.getElementById("prev");
        var content=document.getElementById("content");
        var oDiv=content.getElementsByTagName("div");
        var x=0;
        next.onclick=function(){  //當(dāng)向下翻頁(yè)時(shí)
          oDiv[x].setAttribute("class","next"); //第一個(gè)頁(yè) 設(shè)置class名讓他向下走去
          x++
          if(x>oDiv.length-1){
            x=0
          }
          oDiv[x].setAttribute("class","prev"); //++過(guò)后讓他的下一個(gè)頁(yè)面起來(lái)
        }
        prev.onclick=function(){    //同上只是++變--
          oDiv[x].setAttribute("class","next");
          x--
          if(x<0){
            x=oDiv.length-1
          }
          oDiv[x].setAttribute("class","prev");
        }
      }
    </script>
  </body>
</html>

以上所述是小編給大家介紹的CSS3+JavaScript實(shí)現(xiàn)翻頁(yè)幻燈片效果,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論