well-waterfall 1.2.5 → 1.2.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "well-waterfall",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "Create Swipers in Webflow with attributes",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",
package/src/index.ts CHANGED
@@ -100,7 +100,9 @@ function initConfig(el: HTMLElement, index: number) {
100
100
 
101
101
  // Initialize swiper
102
102
  const swiperEl = el.querySelector(".swiper");
103
+ if (debug) console.log("SWIPER: ", swiperEl);
103
104
  const slides = swiperEl?.querySelectorAll(".swiper-slide") || [];
105
+ if (debug) console.log("SWIPER SLIDES: ", slides);
104
106
  if (slides.length === 0) {
105
107
  console.warn(`Skipping "${name}": no .swiper-slide elements found.`);
106
108
  return;
@@ -39,11 +39,17 @@ export function playbackConfig(config: SwiperOptions, el: HTMLElement) {
39
39
  config.loopPreventsSliding = parseBoolean(el, ATTR_LOOP_PREVENTS_SLIDING, true);
40
40
  // Autoplay
41
41
  const autoplayMode = parseBoolean(el, ATTR_AUTOPLAY, false);
42
+
43
+ // Smooth Autoplay
44
+ const smoothAutoplay = parseBoolean(el, ATTR_SMOOTH_AUTOPLAY, false);
45
+ let delay = parseNumber(el, ATTR_DELAY, undefined);
46
+ if (smoothAutoplay) delay = 0;
47
+
42
48
  if (autoplayMode) {
43
49
  // Add CSS for Smooth Autoplay
44
50
  setSmoothAutoplay();
45
51
  config.autoplay = {
46
- delay: parseNumber(el, ATTR_DELAY, undefined),
52
+ delay,
47
53
  disableOnInteraction: parseBoolean(el, ATTR_DISABLE_ON_INTERACTION, false), // documentation says default is true, doesn't appear to be correct
48
54
  reverseDirection: parseBoolean(el, ATTR_REVERSE_DIRECTION, false),
49
55
  pauseOnMouseEnter: parseBoolean(el, ATTR_PAUSE_ON_MOUSE_ENTER, false),