繁体   English   中英

Swiper Js - 仅在设备宽度小于等于 515 时启动滑块

[英]Swiper Js - Only start slider when the device width is less than or equal to 515

我正在使用这个滑块: https : //swiperjs.com/api/

现在,我想在设备宽度等于或小于 515 时启动滑块。为此,我使用了这个 JS 代码,但是当设备大于 515 时它不会停止滑块。它应该在设备宽度小于等于515:

var mySwiper = new Swiper('.swiper-container', {
    direction: 'horizontal',
    slidesPerView: 1,
    loop: true,
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
    },
    autoplay: {
        delay: 3000,
    },
    breakpoints: {
        // when window width is >= 320px
        515: {
            slidesPerView: 1,
            spaceBetween: 20
        },
    }
});

小于或等于,如果我是正确的,我认为你做 <= 或 <==

idk 自从我使用 java 脚本以来已经有一段时间了

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM