• Swiper正方体,左右翻转轮播图


    今天的轮播图,和往常的有一点点不同哦!可以说是有一点点的3D效果!因为他在运动的时候,是以正方体的样子左右滚动的;

    先引插件:

    <link rel="stylesheet" href="swiper.css">
    <script src="swiper.js"></script>

    然后还是那句话:翠花,上代码:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Swiper demo</title>
    	<meta name="viewport" content="width=device-width,initial-scale=1"/>
    
        <link rel="stylesheet" href="swiper.css">
    
        <style>
        /*样式*/
        html, body {
            position: relative;
            height: 100%;
        }
        body {
            background: #fff;
            font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
            font-size: 14px;
            color:#000;
            margin: 0;
            padding: 0;
        }
        img{
        	 100%;
        	height: 100%;
        }
        .swiper-container {
             500px;
            height: 500px;
            position: absolute;
            left: 45%;
            top: 35%;
            margin-left: -150px;
            margin-top: -150px;
        }
        .swiper-slide {
            background-position: center;
            background-size: cover;
        }
        </style>
    </head>
    <body>
    <!-- Swiper轮播图 -->
        <div class="swiper-container">
            <div class="swiper-wrapper">
                <div class="swiper-slide"><img src="../img/2d.jpg"/></div>
                <div class="swiper-slide"><img src="../img/2d.jpg"/></div>
                <div class="swiper-slide"><img src="../img/2d.jpg"/></div>
                <div class="swiper-slide"><img src="../img/2d.jpg"/></div>
                <div class="swiper-slide"><img src="../img/2d.jpg"/></div>
            </div>
            <div class="swiper-pagination"></div>
        </div>
    
        <script src="swiper.js"></script>
    
       <script>
        var swiper = new Swiper('.swiper-container', {
            pagination: '.swiper-pagination',
            
            //循环 往返的动
            loop:true,
                    //小白点不能点击
    		autoplayDisableOnInteraction:false,
    		
            effect: 'cube',
            grabCursor: true,
            cube: {
                shadow: true,
                slideShadows: true,
                shadowOffset: 20,
                shadowScale: 0.94
            }
        });
        </script>
    </body>
    </html>
    

      有没有很简单啊!!!

  • 相关阅读:
    PGsql 基本用户权限操作
    Node.js版本管理工具 nvm
    js 数字前面自动补零
    浮点数向偶数舍入的问题 Round-to-Even for Floating Point
    Linux 目录下属性查看操作
    C语言之Bit-wise Operation和Logical Operation
    (转)SqlBulkCopy批量复制数据
    (转)VS2010启动调试时老是提示正在下载公共符号
    转 SVN 在vs中的使用
    (转)关于 HTTP meta 的 IE=edge 说明
  • 原文地址:https://www.cnblogs.com/yang-ting/p/7083208.html
Copyright © 2020-2023  润新知