Home  >  Article  >  Web Front-end  >  Basic use of swiper (15)

Basic use of swiper (15)

黄舟
黄舟Original
2017-01-20 15:41:141573browse

This time we introduce the page turning animation on the swiper page - the gradient effect
Since there is page turning, the page turning effect is definitely indispensable. This function is also packaged for us in swiper, so we are using it becomes very convenient.
First perform basic layout and CSS style settings.

第一页
第二页
第三页

In order to make the animation effect obvious, I added a background image to each slide.
Then initialize it in JS and add the property of page turning animation.

 var swiper = new Swiper('.swiper-container',{
            pagination:'.swiper-pagination',
            paginationClickable:true,
            nextButton:'.swiper-button-next',
            prevButton:'.swiper-button-prev',
            effect:'fade'   //动画效果:渐变
        });

In this way, the gradient page turning animation is realized. It is very simple, just add an attribute (effect:'fade') in the initialization.

The above is the basic use of swiper (15). For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!


Statement:
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
Previous article:Basic use of swiper (14)Next article:Basic use of swiper (14)