Created
October 11, 2016 13:30
-
-
Save Yurii-Chaban/5f7bf5bf862ed1cc4aa7ebe6a1842d18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var swiper_main = new Swiper('.swiper-container-design-mobile', { | |
paginationClickable: true, | |
loop: true, | |
slidesPerView: 3, | |
spaceBetween: 30, | |
centeredSlides: true, | |
autoplay: 3500, | |
speed: 1000, | |
freeMode: true, | |
watchSlidesProgress: true, | |
autoplayDisableOnInteraction: false | |
}); | |
$(document).ready(function(){ | |
var mySwiper = new Swiper('.swiper-container-design-mobile',{ | |
centeredSlides: true, | |
simulateTouch: false, | |
loop: true, | |
slidesPerView: 3, | |
spaceBetween: 30, | |
autoplay: 3500, | |
speed: 1000, | |
freeMode: true, | |
slidesPerView: 'auto' | |
}); | |
function fixSwiper() { | |
if ($(window).width() < 1375) { | |
//For example 3 slides per slide: | |
$('.swiper-slide').css({width: mySwiper.width/3}) | |
} | |
if ($(window).width() < 675) { | |
//For example 2 slides per slide: | |
$('.swiper-slide').css({width: mySwiper.width/2}) | |
} | |
if ($(window).width() <= 320) { | |
//For example 2 slides per slide: | |
$('.swiper-slide').css({width: mySwiper.width}) | |
} | |
mySwiper.reInit() | |
} | |
//Fix it right after initialization | |
fixSwiper(); | |
//And on window resize | |
$(window).resize(function(){ fixSwiper() }) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment