中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

CSS3如何制作輪播圖切割效果

發布時間:2022-02-28 10:30:23 來源:億速云 閱讀:119 作者:小新 欄目:web開發

這篇文章主要介紹CSS3如何制作輪播圖切割效果,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

<!DOCTYPE html>

<html lang="en">

<head>

         <meta charset="UTF-8">

         <title>炫酷CSS3切割效果輪播圖</title>

         <meta name="description" content="炫酷CSS3切割效果輪播圖" />

         <meta name="keywords" content="炫酷,CSS3,切割效果,輪播圖" />

         <meta name="author" content="js代碼" />

         <meta name="Copyright" content="js代碼" />

         <style type="text/css">

                   html,body,div{

                            margin: 0;

                            padding: 0;                         

                   }

                   body{background-color: #232323}

                   .slider-outer{

                            width: 560px;

                            height: 300px;

                            margin: 150px auto;

                            background-color: #f60;

                            position: relative;

                   }

                   .img-item{

                            position: absolute;

                            width: 112px;

                            height: 100%;

                            background-color: #f10;

                            transition: all 1.5s;

                            /*設置子元素在3D空間中呈現*/

                            transform-style: preserve-3d;

                   }

                   /*讓圖片可以構成一個有四個面的長方體 start*/

                   .img{

                            width: 100%;

                            height: 100%;

                            position: absolute;

                            background-size: cover;

                   }

                   .img:nth-child(1){

                            background: url(images/1.png) no-repeat;

                            transform: rotateX(0deg) translateZ(150px);

                   }

                   .img:nth-child(2){

                            background: url(images/2.png) no-repeat;

                            transform: rotateX(-90deg) translateZ(150px);

                   }

                   .img:nth-child(3){

                            background: url(images/3.png) no-repeat;

                            transform: rotateX(-180deg) translateZ(150px);

                   }

                   .img:nth-child(4){

                            background: url(images/4.png) no-repeat;

                            transform: rotateX(-270deg) translateZ(150px);

                   }

                   /*讓圖片可以構成一個有四個面的長方體 end*/

                   .btns{

                            position: absolute;

                            top: 50%;

                            width: 100%;

                            height: 70px;

                            margin-top: -35px;

                   }

                   .prev,

                   .next{

                            width: 70px;

                            height: 70px;

                            line-height: 70px;

                            text-align: center;

                            background-color: rgba(0,0,0,.3);

                            color: #fff;

                            font-size: 30px;

                            cursor: pointer;

                            position: absolute;

                   }

                   .prev{

                            left: 0;

                   }

                   .next{

                            right: 0;

                   }

         </style>

         <script src="js/jquery-1.11.3.min.js"></script>

         <script type="text/javascript">

                   $(function (){

                            var num = 0;

                            $("#j_silder_outer .img-item").each(function(index, el) {

                                     $(this).css({

                                               "left":$(this).width() * index + "px",

                                               /*讓每個img-item延時一定時間執行動畫*/

                                               "transitionDelay": index * 0.3 + "s"

                                     });

                                     $(this).find(".img").css({

                                               "backgroundPosition": -$(this).width() * index + "px"

                                     });;

                            });

 

                            $(".prev").on("click",function (){

                                     $("#j_silder_outer .img-item").css("transform", "rotateX(" + (++num * 90) + "deg)");

                            });

 

                            $(".next").on("click",function (){

                                     $("#j_silder_outer .img-item").css("transform", "rotateX(" + (--num * 90) + "deg)");

                            });

                           

                            var timejg=4000;//輪播間隔時間

                            var time = setInterval(move,timejg);

                            function move(){

                                     $("#j_silder_outer .img-item").css("transform", "rotateX(" + (--num * 90) + "deg)");

                            }

                            $('.slider-outer').hover(function(){

                                     clearInterval(time);

                            },function(){

                                     time = setInterval(move,timejg);

                            });

 

 

                   })

                  

                  

 

                  

         </script>

</head>

<body>

         <div class="slider-outer" id="j_silder_outer">

                   <div class="img-item">

                            <div class="img"></div>

                            <div class="img"></div>

                            <div class="img"></div>

                            <div class="img"></div>

                   </div>

                   <div class="img-item">

                            <div class="img"></div>

                            <div class="img"></div>

                            <div class="img"></div>

                            <div class="img"></div>

                   </div>

                   <div class="img-item">

                            <div class="img"></div>

                            <div class="img"></div>

                            <div class="img"></div>

                            <div class="img"></div>

                   </div>

                   <div class="img-item">

                            <div class="img"></div>

                            <div class="img"></div>

                            <div class="img"></div>

                            <div class="img"></div>

                   </div>

                   <div class="img-item">

                            <div class="img"></div>

                            <div class="img"></div>

                            <div class="img"></div>

                            <div class="img"></div>

                   </div>

                   <div class="btns" data-num="0">

                            <div class="prev"><</div>

                            <div class="next">></div>

                   </div>

         </div>

</body>

</html>

以上是“CSS3如何制作輪播圖切割效果”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

嵊泗县| 明水县| 揭东县| 全州县| 滁州市| 磐石市| 北京市| 云梦县| 廊坊市| 平舆县| 娱乐| 清流县| 淳化县| 开化县| 琼结县| 通州市| 永靖县| 左云县| 霞浦县| 富民县| 水城县| 迭部县| 灌阳县| 古丈县| 信宜市| 饶河县| 鄂伦春自治旗| 呼和浩特市| 铜陵市| 溧水县| 高清| 大足县| 望江县| 塔城市| 方城县| 柳河县| 丘北县| 阜新市| 青川县| 壶关县| 滨州市|