28 lines
868 B
JavaScript
28 lines
868 B
JavaScript
define([
|
|
'Swiper'
|
|
], function (Swiper) {
|
|
'use strict';
|
|
|
|
return function (config, element) {
|
|
var hasNavigation = element.getAttribute('data-has-navigation') === 'true';
|
|
var container = element.closest('.esun-news-room');
|
|
|
|
new Swiper(element, {
|
|
slidesPerView: 1,
|
|
slidesPerGroup: 1,
|
|
spaceBetween: 36,
|
|
observer: true,
|
|
observeParents: true,
|
|
watchOverflow: true,
|
|
navigation: hasNavigation ? {
|
|
nextEl: container.querySelector('.esun-news-room__next'),
|
|
prevEl: container.querySelector('.esun-news-room__previous')
|
|
} : {},
|
|
pagination: hasNavigation ? {
|
|
el: element.querySelector('.esun-news-room__pagination'),
|
|
clickable: true
|
|
} : {}
|
|
});
|
|
};
|
|
});
|