well-waterfall 0.1.19 → 0.1.21

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/waterfall.ts +19 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "well-waterfall",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "An attribute-based wrapper of SwiperJS for Webflow",
5
5
  "main": "waterfall.js",
6
6
  "scripts": {
package/src/waterfall.ts CHANGED
@@ -17,7 +17,7 @@ $('[waterfall]').each(function (index) {
17
17
  const name = parseAttr($this, 'waterfall', `Swiper ${index}`);
18
18
  const debug = Boolean(parseAttr($this, 'debug-mode', false) || false);
19
19
 
20
- console.log(`Initializing Waterfall: ${name}` + debug ? '[DEBUG MODE]' : '');
20
+ console.log(`Initializing Waterfall: ${name} ${debug ? '[DEBUG MODE]' : ''}`);
21
21
 
22
22
  const swiperConfig: any = {
23
23
  a11y: {
@@ -466,3 +466,21 @@ $('[waterfall]').each(function (index) {
466
466
 
467
467
  sliders.push({ name, slider: swiper });
468
468
  });
469
+
470
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
471
+ // --- SLIDE COUNT ----------------------------
472
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
473
+
474
+ // THIS NEEDS TO RUN AFTER THE SLIDERS HAVE BEEN INITIALIZED?
475
+
476
+ document.querySelectorAll('.swiper-wrapper').forEach((swiperWrapper) => {
477
+ console.log('SWIPER WRAPPER');
478
+ swiperWrapper.querySelectorAll('.swiper-slide').forEach((slide, index) => {
479
+ console.log('SWIPER SLIDE');
480
+ const countEl = slide.querySelector('[waterfall-el="slide-count"]');
481
+ if (countEl) {
482
+ console.log('SWIPER COUNT');
483
+ countEl.textContent = (index + 1).toString();
484
+ }
485
+ });
486
+ });