slick.js 自适应 支持手机端滑动的幻灯片插件

slick.js 自适应 支持手机端滑动的幻灯片插件

第一步引入bfwone

第二步执行插件

示例如下

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>BFW NEW PAGE</title>
    <script id="bfwone" data="dep=jquery.17&" type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/bfwone.js"></script>
    <script type="text/javascript">
        bready(function() {
            use(["slick", "slick|slick-theme"], function() {
                $('.single-item').slick();
                $('.multiple-items').slick({

                    infinite: true,

                    slidesToShow: 3,

                    slidesToScroll: 3

                });
            });
        });
    </script>
    <style>
        .slider {
            margin: 20px;
            text-align: center;
        }
        .slider div {
            background: white;
            height: 100px;
            width: 100%;
            line-height: 60px;
        }
    </style>
</head>
<body>
    <h2>Single Item</h2>
    <div class="slider single-item" style="margin:20px;">
        <div>
            <h3>1</h3>
        </div>
        <div>
            <h3>2</h3>
        </div>
        <div>
            <h3>3</h3>
        </div>
        <div>
            <h3>4</h3>
        </div>
        <div>
            <h3>5</h3>
        </div>
        <div>
            <h3>6</h3>
        </div>
    </div>
    <h2>Multiple Items</h2>
    <div class="slider multiple-items">
        <div>
            <h3>1</h3>
        </div>
        <div>
            <h3>2</h3>
        </div>
        <div>
            <h3>3</h3>
        </div>
        <div>
            <h3>4</h3>
        </div>
        <div>
            <h3>5</h3>
        </div>
        <div>
            <h3>6</h3>
        </div>
        <div>
            <h3>7</h3>
        </div>
        <div>
            <h3>8</h3>
        </div>
        <div>
            <h3>9</h3>
        </div>
    </div>
</body>
</html>

跟多例子请看官网http://kenwheeler.github.io/slick/
立即下载slick.js查看所有js插件

网友评论0

程序员在线工具箱