40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
define([
|
|
'Swiper'
|
|
], function (Swiper) {
|
|
'use strict';
|
|
|
|
return function (config, element) {
|
|
var hasNavigation = element.getAttribute('data-has-navigation') === 'true';
|
|
|
|
if (window.matchMedia('(max-width: 639px)').matches) {
|
|
return;
|
|
}
|
|
|
|
new Swiper(element, {
|
|
slidesPerView: 1.26,
|
|
spaceBetween: 12,
|
|
observer: true,
|
|
observeParents: true,
|
|
watchOverflow: true,
|
|
breakpoints: {
|
|
768: {
|
|
slidesPerView: 2,
|
|
spaceBetween: 20
|
|
},
|
|
1024: {
|
|
slidesPerView: 4,
|
|
spaceBetween: 28
|
|
}
|
|
},
|
|
navigation: hasNavigation ? {
|
|
nextEl: element.querySelector('.esun-create-anything__next'),
|
|
prevEl: element.querySelector('.esun-create-anything__previous')
|
|
} : {},
|
|
pagination: hasNavigation ? {
|
|
el: element.querySelector('.esun-create-anything__pagination'),
|
|
clickable: true
|
|
} : {}
|
|
});
|
|
};
|
|
});
|