swiper轮播器的常用案例分析(swiper hover停止mouseover停止)

API地址

基础演示

 

hover停止需要自己设置,代码如下

var mySwiper= new Swiper('.swiper-container', {
       //这里的常规的设置参数
        pagination: '.swiper-pagination',
        slidesPerView: 5,
        paginationClickable: true,
        spaceBetween: 30,
        loop:true,
        autoplay:1000,
        loopedSlides:5
    });
    $('.swiper-container').mouseover(function(){
        mySwiper.stopAutoplay();
    })
    $('.swiper-container').mouseout(function(){
        mySwiper.startAutoplay();
    })

注意事项:名称一定要一致,至于事件加到谁身上,自己决定。

原文地址:https://www.cnblogs.com/haley168/p/swiperAPI.html