well-waterfall 0.0.2 → 0.0.3
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 +27 -0
- package/package.json +1 -1
- package/src/waterfall.js +10 -1
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# 🥞 Syrup by Wellflow
|
|
2
|
+
|
|
3
|
+
Syrup is an attributes-based animation library built for creating quick and customizable animations in Webflow.
|
|
4
|
+
|
|
5
|
+
## Video Scroll
|
|
6
|
+
|
|
7
|
+
With this attribute, you can make a video play and reverse on scroll. This tool is built on top of the [scrolly-video](https://www.npmjs.com/package/scrolly-video?activeTab=readme) package.
|
|
8
|
+
|
|
9
|
+
**To create a Video Scroll, create a Custom Element with tag 'div' (video will not work) with the following styles:**
|
|
10
|
+
Width: 100vw
|
|
11
|
+
Height: 100vh
|
|
12
|
+
Position: Sticky
|
|
13
|
+
Fit: Cover
|
|
14
|
+
|
|
15
|
+
**Then add the following attributes:**
|
|
16
|
+
[syrup-el='scroll-video']
|
|
17
|
+
[src='YOUR_VIDEO_SRC']
|
|
18
|
+
[autoPlay='false']
|
|
19
|
+
[muted='true']
|
|
20
|
+
[loop='true']
|
|
21
|
+
[playsInline='true']
|
|
22
|
+
|
|
23
|
+
**Webflow Designer Placeholder**
|
|
24
|
+
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']
|
|
25
|
+
|
|
26
|
+
**Video Hosting Tips**
|
|
27
|
+
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
package/src/waterfall.js
CHANGED
|
@@ -16,6 +16,12 @@ function getAttrOrDefault(el, attrName, defaultValue) {
|
|
|
16
16
|
$(".waterfall").each(function (index) {
|
|
17
17
|
const $this = $(this);
|
|
18
18
|
const name = getAttrOrDefault($this, "slidername", `Slider ${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,6 +61,7 @@ $(".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,
|
|
@@ -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
|
-
|
|
88
|
+
printDebug("SCROLLBAR", scrollbarEl);
|
|
80
89
|
if (scrollbarEl && parseBool(getAttrOrDefault($this, "scrollbarMode", false))) {
|
|
81
90
|
swiperConfig.scrollbar = {
|
|
82
91
|
dragClass: $(scrollbarEl)
|