1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Modules included:
// 'virtual',
// 'mousewheel',
// 'navigation',
// 'pagination',
// 'zoom',
// 'lazy',
// 'autoplay',
// 'thumbs',
// 'manipulation',
// 'effect-fade',
$$plugins.define('slider', ['swiper-bundle'], function (element, options, Swiper) {
if (element.childNodes.length == 0) {
return;
}
// init Swiper
const swiper = new Swiper(element, {
autoHeight: options.autoHeight ? options.autoHeight : false,
breakpoints: options.breakpoints,
centerInsufficientSlides: options.centerInsufficientSlides ? options.centerInsufficientSlides : false,
centeredSlides: options.centeredSlides ? options.centeredSlides : false,
direction: options.direction ? options.direction : 'horizontal',
effect: options.effect ? options.effect : 'slide',
loop: options.loop ? options.loop : false,
navigation: {
nextEl: element.querySelector('.swiper-button-next'),
prevEl: element.querySelector('.swiper-button-prev'),
},
pagination: {
el: element.querySelector('.swiper-pagination'),
type: 'bullets',
clickable: 'true'
},
slidesPerGroup: options.slidesPerGroup ? options.slidesPerGroup : 1,
slidesPerView: options.slidesPerView ? options.slidesPerView : 1,
spaceBetween: options.spaceBetween ? options.spaceBetween : 0,
speed: options.speed ? options.speed : 800,
watchSlidesProgress: true
});
});
|