well-waterfall 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +518 -519
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +21 -16
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -49,15 +49,26 @@ function initAll(selector: string, startIndex: number): number {
|
|
|
49
49
|
|
|
50
50
|
let indexCounter = 0;
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
53
|
+
// Initialize all other sliders
|
|
54
|
+
document.querySelectorAll(`[${ATTR_WATERFALL}]`).forEach((el) => {
|
|
55
|
+
if (el.hasAttribute(ATTR_THUMBS) || el.hasAttribute(ATTR_CONTROLLER)) return;
|
|
56
|
+
initConfig(el as HTMLElement, indexCounter++);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Initialize Controller Sliders last
|
|
60
|
+
indexCounter = initAll(`[${ATTR_WATERFALL}][${ATTR_THUMBS}]`, indexCounter);
|
|
61
|
+
indexCounter = initAll(`[${ATTR_WATERFALL}][${ATTR_CONTROLLER}]`, indexCounter);
|
|
62
|
+
|
|
63
|
+
// MANIPULATION
|
|
64
|
+
manipulateSlides();
|
|
57
65
|
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
// SLIDE COUNT
|
|
67
|
+
initSlideCount();
|
|
68
|
+
|
|
69
|
+
// ARIA ROLE FIX FOR WEBFLOW CMS LIST
|
|
70
|
+
fixWebflowCMSListARIARole();
|
|
71
|
+
});
|
|
61
72
|
|
|
62
73
|
// Config
|
|
63
74
|
function initConfig(el: HTMLElement, index: number) {
|
|
@@ -100,7 +111,9 @@ function initConfig(el: HTMLElement, index: number) {
|
|
|
100
111
|
|
|
101
112
|
// Initialize swiper
|
|
102
113
|
const swiperEl = el.querySelector(".swiper");
|
|
114
|
+
if (debug) console.log("SWIPER: ", swiperEl);
|
|
103
115
|
const slides = swiperEl?.querySelectorAll(".swiper-slide") || [];
|
|
116
|
+
if (debug) console.log("SWIPER SLIDES: ", slides);
|
|
104
117
|
if (slides.length === 0) {
|
|
105
118
|
console.warn(`Skipping "${name}": no .swiper-slide elements found.`);
|
|
106
119
|
return;
|
|
@@ -110,11 +123,3 @@ function initConfig(el: HTMLElement, index: number) {
|
|
|
110
123
|
}
|
|
111
124
|
}
|
|
112
125
|
|
|
113
|
-
// MANIPULATION
|
|
114
|
-
manipulateSlides();
|
|
115
|
-
|
|
116
|
-
// SLIDE COUNT
|
|
117
|
-
initSlideCount();
|
|
118
|
-
|
|
119
|
-
// ARIA ROLE FIX FOR WEBFLOW CMS LIST
|
|
120
|
-
fixWebflowCMSListARIARole();
|