... | ... |
@@ -9,8 +9,13 @@ $GLOBALS['TL_CSS'][] = '/system/modules/eSM_swiper/assets/css/swiper-custom.css' |
9 | 9 |
|
10 | 10 |
<script> |
11 | 11 |
(function () { |
12 |
- var cte = document.querySelectorAll(".ce_swiperSliderStart"), e, w, s, i, c, |
|
13 |
- defaults = { |
|
12 |
+ var cte = document.querySelectorAll(".ce_swiperSliderStart"); |
|
13 |
+ |
|
14 |
+ for (var i=0; i<cte.length; i++) |
|
15 |
+ { |
|
16 |
+ var e = cte[i].querySelectorAll('.swiper-container')[0]; |
|
17 |
+ var w = e.querySelectorAll('.swiper-wrapper')[0]; |
|
18 |
+ var c = { |
|
14 | 19 |
initialSlide: 0, |
15 | 20 |
speed: 300, |
16 | 21 |
autoHeight: false, |
... | ... |
@@ -22,15 +27,9 @@ $GLOBALS['TL_CSS'][] = '/system/modules/eSM_swiper/assets/css/swiper-custom.css' |
22 | 27 |
autoplay: false |
23 | 28 |
}; |
24 | 29 |
|
25 |
- for (i=0; i<cte.length; i+=2) |
|
26 |
- { |
|
27 |
- e = cte[i].querySelectorAll('.swiper-container')[0]; |
|
28 |
- w = e.querySelectorAll('.swiper-wrapper')[0]; |
|
29 |
- c = defaults; |
|
30 |
- |
|
31 | 30 |
if (w.hasAttribute('data-config')) |
32 | 31 |
{ |
33 |
- s = w.getAttribute('data-config').split(','); |
|
32 |
+ var s = w.getAttribute('data-config').split(','); |
|
34 | 33 |
|
35 | 34 |
c.speed = parseInt(s[1]); |
36 | 35 |
c.initialSlide = parseInt(s[2]); |
... | ... |
@@ -68,8 +67,20 @@ $GLOBALS['TL_CSS'][] = '/system/modules/eSM_swiper/assets/css/swiper-custom.css' |
68 | 67 |
if (parseInt(s[11]) == 1) |
69 | 68 |
c.autoHeight = true; |
70 | 69 |
|
70 |
+ if (s[12] !== '') |
|
71 |
+ c.slideClass = s[12]; |
|
72 |
+ |
|
73 |
+ } |
|
74 |
+ if (w.hasAttribute('data-breakpoints')) |
|
75 |
+ { |
|
76 |
+ try { |
|
77 |
+ var breakpoints = JSON.parse(w.getAttribute('data-breakpoints')); |
|
78 |
+ c.breakpoints = breakpoints; |
|
79 |
+ } catch (e) |
|
80 |
+ { |
|
81 |
+ console.log('Swiper.js: breakpoint data attribute is not valid JSON'); |
|
82 |
+ } |
|
71 | 83 |
} |
72 |
-console.log(c); |
|
73 | 84 |
new Swiper(e,c); |
74 | 85 |
} |
75 | 86 |
})(); |