well-waterfall 0.0.2 → 0.0.4

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/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # 🥞 Waterfall by Wellflow
2
+
3
+ Waterfall is an attributes-based slider library for quickly creating fully customizable sliders without using Javascript! This library is a wrapper for SwiperJS, which is an excellent open-source package.
4
+
5
+ ## Setup
6
+
7
+ Create an element with class .waterfall
8
+
9
+ <!-- Slider main container -->
10
+ <div class="waterfall">
11
+ <!-- Additional required wrapper -->
12
+ <div class="swiper-wrapper">
13
+ <!-- Slides -->
14
+ <div class="swiper-slide">Slide 1</div>
15
+ <div class="swiper-slide">Slide 2</div>
16
+ <div class="swiper-slide">Slide 3</div>
17
+ ...
18
+ </div>
19
+ </div>
20
+
21
+ All slider settings will be added as attributes to the element with the .waterfall class.
22
+
23
+ ## General Settings
24
+
25
+ ## Navigation
26
+
27
+ Navigation allows for buttons to control moving to previous or next slides. To enable navigation, add the attribute [navigationMode="true"].
28
+
29
+ **Navigation Settings**
30
+ NYI (Not Yet Implemented)
31
+
32
+ ## Autoplay
33
+
34
+ Autoplay advances the slider automatically. To enable autoplay, add the attribute [autoplayMode="true"].
35
+
36
+ **Autoplay Settings**
37
+ delay: parseInt(getAttrOrDefault($this, "delay", 0), 10),
38
+ disableOnInteraction: parseBool(getAttrOrDefault($this, "disableOnInteraction", false)),
39
+ reverseDirection: parseBool(getAttrOrDefault($this, "reverseDirection", false)),
40
+ pauseOnMouseEnter: parseBool(getAttrOrDefault($this, "pauseOnMouseEnter", false)),
41
+ stopOnLastSlide: parseBool(getAttrOrDefault($this, "stopOnLastSlide", false)),
42
+
43
+ **Webflow Designer Placeholder**
44
+ To have the video display for a preview in the Webflow Designer, you can duplicate the element and change the tag to 'video'. Give the element the attribute [syrup-el='scroll-video-placeholder']
45
+
46
+ **Video Hosting Tips**
47
+ I host my videos on AWS S3 / CloudFront. It's really easy to set up, cheaper than Vimeo, has no ads, and loads quickly.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "well-waterfall",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "An attribute-based wrapper of SwiperJS for Webflow",
5
5
  "main": "waterfall.js",
6
6
  "scripts": {
package/src/waterfall.js CHANGED
@@ -13,9 +13,15 @@ function getAttrOrDefault(el, attrName, defaultValue) {
13
13
  return $(el).attr(attrName) || defaultValue;
14
14
  }
15
15
 
16
- $(".waterfall").each(function (index) {
16
+ $("[waterfall]").each(function (index) {
17
17
  const $this = $(this);
18
- const name = getAttrOrDefault($this, "slidername", `Slider ${index}`);
18
+ const name = getAttrOrDefault($this, "waterfall", `Swiper ${index}`);
19
+ const debug = getAttrOrDefault($this, "debugMode", false);
20
+
21
+ function printDebug(str, el) {
22
+ if (!debug) return;
23
+ console.log(str, ": ", el);
24
+ }
19
25
 
20
26
  const swiperConfig = {
21
27
  slidesPerView: getAttrOrDefault($this, "portraitSlides", "auto"),
@@ -55,12 +61,13 @@ $(".waterfall").each(function (index) {
55
61
 
56
62
  // Pagination configuration
57
63
  const paginationEl = $this.find("[waterfall-el='pagination']")[0];
64
+ printDebug("PAGINATION", paginationEl);
58
65
  if (paginationEl && parseBool(getAttrOrDefault($this, "paginationMode", false))) {
59
66
  swiperConfig.pagination = {
60
67
  el: paginationEl,
61
68
  clickable: parseBool(getAttrOrDefault($this, "paginationClickable", true)),
62
69
  bulletClass: $this.find("[waterfall-el='pagination-bullet']").attr("class"),
63
- bulletActiveClass: $this.find("[waterfall-pagination-class]").attr("waterfall-pagination-class"),
70
+ bulletActiveClass: $this.find("[waterfall-pagination-active-class]").attr("waterfall-pagination-active-class"),
64
71
  type: "bullets",
65
72
  dynamicBullets: false,
66
73
  };
@@ -72,11 +79,13 @@ $(".waterfall").each(function (index) {
72
79
  nextEl: $this.find("[waterfall-el='next']")[0],
73
80
  prevEl: $this.find("[waterfall-el='prev']")[0],
74
81
  };
82
+ printDebug("NEXT BUTTON", swiperConfig.navigation.nextEl);
83
+ printDebug("PREV BUTTON", swiperConfig.navigation.prevEl);
75
84
  }
76
85
 
77
86
  // Scrollbar configuration
78
87
  const scrollbarEl = $this.find("[waterfall-el='scrollbar']");
79
- console.log("SCROLLBAR: ", scrollbarEl);
88
+ printDebug("SCROLLBAR", scrollbarEl);
80
89
  if (scrollbarEl && parseBool(getAttrOrDefault($this, "scrollbarMode", false))) {
81
90
  swiperConfig.scrollbar = {
82
91
  dragClass: $(scrollbarEl)