как-то так должно работать
function initSlider() {
new Swiper('.swiper', {
loop: false,
sped: 2400,
navigation:{
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
pagination: {
el: '.swiper-pagination',
clickable: true
},
breakpoints: {
// when window width is >= 320px
320: {
slidesPerView: 2,
spaceBetween: 20
},
// when window width is >= 480px
480: {
slidesPerView: 2,
spaceBetween: 30
},
// when window width is >= 1920px
1920: {
slidesPerView: 1,
spaceBetween: 60,
autoplay:false,
}
}
});
}
function detectDevice() {
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
// true for mobile device
initSlider();
}else{
// false for not mobile device
}
}
detectDevice();