well-waterfall 0.0.3 → 0.0.5
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 +36 -16
- package/dist/waterfall.js +1 -1
- package/package.json +1 -1
- package/src/waterfall.js +3 -3
package/README.md
CHANGED
|
@@ -1,24 +1,44 @@
|
|
|
1
|
-
# 🥞
|
|
1
|
+
# 🥞 Waterfall by Wellflow
|
|
2
2
|
|
|
3
|
-
|
|
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
4
|
|
|
5
|
-
##
|
|
5
|
+
## Setup
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Create an element with class .waterfall
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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>
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
[
|
|
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)),
|
|
22
42
|
|
|
23
43
|
**Webflow Designer Placeholder**
|
|
24
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']
|
package/dist/waterfall.js
CHANGED
|
@@ -136,7 +136,7 @@ eval("\n\n/* istanbul ignore next */\nfunction styleTagTransform(css, styleElem
|
|
|
136
136
|
\**************************/
|
|
137
137
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
138
138
|
|
|
139
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var swiper_bundle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! swiper/bundle */ \"./node_modules/swiper/swiper-bundle.mjs\");\n/* harmony import */ var swiper_css_bundle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! swiper/css/bundle */ \"./node_modules/swiper/swiper-bundle.css\");\nconsole.log(\"🚿 Hello from Wellflow Waterfall\");\n\n\n\n\nconst sliders = [];\n\nfunction parseBool(attr) {\n return attr === \"true\";\n}\n\nfunction getAttrOrDefault(el, attrName, defaultValue) {\n return $(el).attr(attrName) || defaultValue;\n}\n\n$(\"
|
|
139
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var swiper_bundle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! swiper/bundle */ \"./node_modules/swiper/swiper-bundle.mjs\");\n/* harmony import */ var swiper_css_bundle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! swiper/css/bundle */ \"./node_modules/swiper/swiper-bundle.css\");\nconsole.log(\"🚿 Hello from Wellflow Waterfall\");\n\n\n\n\nconst sliders = [];\n\nfunction parseBool(attr) {\n return attr === \"true\";\n}\n\nfunction getAttrOrDefault(el, attrName, defaultValue) {\n return $(el).attr(attrName) || defaultValue;\n}\n\n$(\"[waterfall]\").each(function (index) {\n const $this = $(this);\n const name = getAttrOrDefault($this, \"waterfall\", `Swiper ${index}`);\n const debug = getAttrOrDefault($this, \"debugMode\", false);\n\n function printDebug(str, el) {\n if (!debug) return;\n console.log(str, \": \", el);\n }\n\n const swiperConfig = {\n slidesPerView: getAttrOrDefault($this, \"portraitSlides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"portraitCenteredSlides\", false)),\n direction: getAttrOrDefault($this, \"direction\", \"horizontal\"),\n loop: parseBool(getAttrOrDefault($this, \"loopMode\", false)),\n effect: getAttrOrDefault($this, \"effect\", \"slide\"),\n speed: parseInt(getAttrOrDefault($this, \"speed\", 700), 10),\n spaceBetween: parseInt(getAttrOrDefault($this, \"spaceBetween\", 0), 10),\n allowTouchMove: parseBool(getAttrOrDefault($this, \"allowTouchMove\", false)),\n breakpoints: {\n 478: {\n slidesPerView: getAttrOrDefault($this, \"landscapeSlides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"landscapeCenteredSlides\", false)),\n },\n 767: {\n slidesPerView: getAttrOrDefault($this, \"tabletSlides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"tabletCenteredSlides\", false)),\n },\n 991: {\n slidesPerView: getAttrOrDefault($this, \"slides\", \"auto\"),\n centeredSlides: parseBool(getAttrOrDefault($this, \"centeredSlides\", false)),\n },\n }\n };\n\n // Autoplay configuration\n if (parseBool(getAttrOrDefault($this, \"autoplayMode\", false))) {\n swiperConfig.autoplay = {\n delay: parseInt(getAttrOrDefault($this, \"delay\", 0), 10),\n disableOnInteraction: parseBool(getAttrOrDefault($this, \"disableOnInteraction\", false)),\n reverseDirection: parseBool(getAttrOrDefault($this, \"reverseDirection\", false)),\n pauseOnMouseEnter: parseBool(getAttrOrDefault($this, \"pauseOnMouseEnter\", false)),\n stopOnLastSlide: parseBool(getAttrOrDefault($this, \"stopOnLastSlide\", false)),\n };\n }\n\n // Pagination configuration\n const paginationEl = $this.find(\"[waterfall-el='pagination']\")[0];\n printDebug(\"PAGINATION\", paginationEl);\n if (paginationEl && parseBool(getAttrOrDefault($this, \"paginationMode\", false))) {\n swiperConfig.pagination = {\n el: paginationEl,\n clickable: parseBool(getAttrOrDefault($this, \"paginationClickable\", true)),\n bulletClass: $this.find(\"[waterfall-el='pagination-bullet']\").attr(\"class\"),\n bulletActiveClass: $this.find(\"[waterfall-pagination-active-class]\").attr(\"waterfall-pagination-active-class\"),\n type: \"bullets\",\n dynamicBullets: false,\n };\n }\n\n // Navigation configuration\n if (parseBool(getAttrOrDefault($this, \"navigationMode\", false))) {\n swiperConfig.navigation = {\n nextEl: $this.find(\"[waterfall-el='next']\")[0],\n prevEl: $this.find(\"[waterfall-el='prev']\")[0],\n };\n printDebug(\"NEXT BUTTON\", swiperConfig.navigation.nextEl);\n printDebug(\"PREV BUTTON\", swiperConfig.navigation.prevEl);\n }\n\n // Scrollbar configuration\n const scrollbarEl = $this.find(\"[waterfall-el='scrollbar']\");\n printDebug(\"SCROLLBAR\", scrollbarEl);\n if (scrollbarEl && parseBool(getAttrOrDefault($this, \"scrollbarMode\", false))) {\n swiperConfig.scrollbar = {\n dragClass: $(scrollbarEl)\n .find(\"[waterfall-el='scrollbar-drag']\")\n .attr(\"class\"),\n dragSize: \"auto\",\n draggable: false,\n el: \".\" + scrollbarEl.attr(\"class\"),\n enabled: true,\n hide: false,\n horizontalClass: \"swiper-scrollbar-horizontal\",\n lockClass: \"swiper-scrollbar-lock\",\n scrollbarDisabledClass: \"swiper-scrollbar-disabled\",\n snapOnRelease: false,\n verticalClass: \"swiper-scrollbar-vertical\",\n };\n }\n\n // Initialize swiper\n const swiper = new swiper_bundle__WEBPACK_IMPORTED_MODULE_0__[\"default\"]($this.find(\".swiper\")[0], swiperConfig);\n\n sliders.push({ name, slider: swiper });\n});\n\n//# sourceURL=webpack://Waterfall/./src/waterfall.js?");
|
|
140
140
|
|
|
141
141
|
/***/ }),
|
|
142
142
|
|
package/package.json
CHANGED
package/src/waterfall.js
CHANGED
|
@@ -13,9 +13,9 @@ function getAttrOrDefault(el, attrName, defaultValue) {
|
|
|
13
13
|
return $(el).attr(attrName) || defaultValue;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
$("
|
|
16
|
+
$("[waterfall]").each(function (index) {
|
|
17
17
|
const $this = $(this);
|
|
18
|
-
const name = getAttrOrDefault($this, "
|
|
18
|
+
const name = getAttrOrDefault($this, "waterfall", `Swiper ${index}`);
|
|
19
19
|
const debug = getAttrOrDefault($this, "debugMode", false);
|
|
20
20
|
|
|
21
21
|
function printDebug(str, el) {
|
|
@@ -67,7 +67,7 @@ $(".waterfall").each(function (index) {
|
|
|
67
67
|
el: paginationEl,
|
|
68
68
|
clickable: parseBool(getAttrOrDefault($this, "paginationClickable", true)),
|
|
69
69
|
bulletClass: $this.find("[waterfall-el='pagination-bullet']").attr("class"),
|
|
70
|
-
bulletActiveClass: $this.find("[waterfall-pagination-class]").attr("waterfall-pagination-class"),
|
|
70
|
+
bulletActiveClass: $this.find("[waterfall-pagination-active-class]").attr("waterfall-pagination-active-class"),
|
|
71
71
|
type: "bullets",
|
|
72
72
|
dynamicBullets: false,
|
|
73
73
|
};
|