Home > Web Front-end > HTML Tutorial > Basic use of swiper (5)

Basic use of swiper (5)

黄舟
Release: 2017-01-20 15:21:26
Original
1301 people have browsed it

This section explains how to display swiper pages in groups.
Sometimes only displaying one page on a screen cannot meet our development needs. Swiper packages a method of displaying a group of pages on one screen. You only need to add an attribute to the initialization of the swiper page.

The first step is to write a basic swiper page.


<div class="swiper-wrapper">
                <div class="swiper-slide">第一页</div>
                <div class="swiper-slide">第二页</div>
                <div class="swiper-slide">第三页</div>
                <div class="swiper-slide">第四页</div>
                <div class="swiper-slide">第五页</div>
                <div class="swiper-slide">第六页</div>
                <div class="swiper-slide">第七页</div>
                <div class="swiper-slide">第八页</div>
                <div class="swiper-slide">第九页</div>
                <div class="swiper-slide">第十页</div>
            </div>
        </div>
Copy after login

Then initialize the page in js and add attributes for better viewing effect.
We added a slide gap to the page.

<script>
            var swiper = new Swiper(&#39;.swiper-container&#39;,{
                slidesPerView:3,   //页面分组显示,这里显示为3组
                spaceBetween:30   //slide间隙
            });
        </script>
Copy after login


Of course, don’t forget to quote our framework file, so when you run our page, you will find that a group of our pages will be displayed on the current screen.

The above is the basic use of swiper (5). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template