well-waterfall 1.3.0 → 1.3.2
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 +599 -72
- package/dist/well-waterfall.es.js +4743 -4332
- package/dist/well-waterfall.es.js.map +1 -1
- package/dist/well-waterfall.umd.js +6 -6
- package/dist/well-waterfall.umd.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,115 +1,642 @@
|
|
|
1
|
-
|
|
1
|
+
[](https://www.npmjs.com/package/well-waterfall) [](https://github.com/prettier/prettier)
|
|
2
2
|
|
|
3
|
-
# 🚿 Waterfall by
|
|
3
|
+
# 🚿 Waterfall by Wellspring 🚿
|
|
4
4
|
|
|
5
|
-
Waterfall is a free-forever
|
|
5
|
+
Waterfall is a free-forever JavaScript library for Webflow that lets you build [SwiperJS](https://swiperjs.com/) sliders entirely with HTML attributes. The Wellspring App helps you create, edit, and manage Waterfalls inside the Webflow Designer with an easy-to-use interface and built-in documentation.
|
|
6
6
|
|
|
7
7
|
1. **Free to Use.** Waterfall is free to use - no monthly subscription.
|
|
8
|
-
2. **No Custom Code.**
|
|
9
|
-
3. **Full Documentation.**
|
|
10
|
-
4. **Turn Swipers into Components.** After creating a swiper, you can turn it into a component for
|
|
8
|
+
2. **No Custom Code.** Every setting is an attribute, so no JavaScript is required.
|
|
9
|
+
3. **Full Documentation.** Every attribute is listed below, and each setting is explained directly in the Wellspring App.
|
|
10
|
+
4. **Turn Swipers into Components.** After creating a swiper, you can turn it into a Webflow component for reuse.
|
|
11
|
+
|
|
12
|
+
Current version: **v<!-- version -->1.3.1<!-- /version -->** · Bundled SwiperJS: **<!-- swiper-version -->11.2.10<!-- /swiper-version -->**
|
|
11
13
|
|
|
12
14
|
## Table of contents
|
|
13
15
|
|
|
14
|
-
- [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- [
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
16
|
+
- [Dependencies](#dependencies)
|
|
17
|
+
- [Installation](#installation)
|
|
18
|
+
- [Usage](#usage)
|
|
19
|
+
- [Waterfall Layout](#waterfall-layout)
|
|
20
|
+
- [How Attributes Work](#how-attributes-work)
|
|
21
|
+
- [Attribute Reference](#attribute-reference)
|
|
22
|
+
- [Core](#core)
|
|
23
|
+
- [Layout](#layout)
|
|
24
|
+
- [Responsive Breakpoints](#responsive-breakpoints)
|
|
25
|
+
- [Playback (Loop, Rewind, Speed)](#playback-loop-rewind-speed)
|
|
26
|
+
- [Autoplay](#autoplay)
|
|
27
|
+
- [Autoplay Control Button](#autoplay-control-button)
|
|
28
|
+
- [Navigation](#navigation)
|
|
29
|
+
- [Pagination](#pagination)
|
|
30
|
+
- [Scrollbar](#scrollbar)
|
|
31
|
+
- [Effects](#effects)
|
|
32
|
+
- [Free Mode](#free-mode)
|
|
33
|
+
- [Grid](#grid)
|
|
34
|
+
- [Thumbs](#thumbs)
|
|
35
|
+
- [Controller](#controller)
|
|
36
|
+
- [Touch & Swiping](#touch--swiping)
|
|
37
|
+
- [Keyboard Control](#keyboard-control)
|
|
38
|
+
- [Mousewheel Control](#mousewheel-control)
|
|
39
|
+
- [Hash Navigation](#hash-navigation)
|
|
40
|
+
- [History Navigation](#history-navigation)
|
|
41
|
+
- [Zoom](#zoom)
|
|
42
|
+
- [Parallax](#parallax)
|
|
43
|
+
- [Lazy Loading](#lazy-loading)
|
|
44
|
+
- [Accessibility (a11y)](#accessibility-a11y)
|
|
45
|
+
- [Observer](#observer)
|
|
46
|
+
- [CSS Classes](#css-classes)
|
|
47
|
+
- [Advanced](#advanced)
|
|
48
|
+
- [Callbacks](#callbacks)
|
|
49
|
+
- [Slide Manipulation](#slide-manipulation)
|
|
50
|
+
- [Element Reference](#element-reference)
|
|
51
|
+
- [JavaScript API](#javascript-api)
|
|
52
|
+
- [Not Supported](#not-supported)
|
|
53
|
+
- [Development](#development)
|
|
54
|
+
- [Built With](#built-with)
|
|
55
|
+
- [Authors](#authors)
|
|
56
|
+
- [License](#license)
|
|
25
57
|
|
|
26
58
|
## Dependencies
|
|
27
59
|
|
|
28
|
-
Waterfall bundles
|
|
60
|
+
Waterfall bundles SwiperJS <!-- swiper-version -->11.2.10<!-- /swiper-version --> (JavaScript and CSS) directly. If you already load SwiperJS on your site, you can remove it and just use Waterfall.
|
|
29
61
|
|
|
30
62
|
## Installation
|
|
31
63
|
|
|
32
|
-
|
|
64
|
+
Use the Wellspring App to install the code onto your site. If you are installing manually, add the script to the **Footer Code** (before the `</body>` tag) in your Webflow Project Settings.
|
|
33
65
|
|
|
34
|
-
**
|
|
66
|
+
**Specific Version (Stable - Recommended)**
|
|
35
67
|
|
|
68
|
+
```html
|
|
69
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/well-waterfall@1.3.1"></script>
|
|
36
70
|
```
|
|
71
|
+
|
|
72
|
+
**Latest Version**
|
|
73
|
+
|
|
74
|
+
```html
|
|
37
75
|
<script type="module" src="https://cdn.jsdelivr.net/npm/well-waterfall"></script>
|
|
38
76
|
```
|
|
39
77
|
|
|
40
|
-
**
|
|
78
|
+
**npm**
|
|
41
79
|
|
|
42
|
-
```
|
|
43
|
-
|
|
80
|
+
```bash
|
|
81
|
+
npm install well-waterfall
|
|
44
82
|
```
|
|
45
83
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
- All General settings
|
|
49
|
-
- Navigation
|
|
50
|
-
- Pagination
|
|
51
|
-
- Scrollbar
|
|
52
|
-
- Autoplay
|
|
53
|
-
- Free Mode
|
|
54
|
-
- Grid
|
|
55
|
-
- Manipulation
|
|
56
|
-
- Parallax
|
|
57
|
-
- Lazy Loading
|
|
58
|
-
- Effects
|
|
59
|
-
- Thumbs
|
|
60
|
-
- Zoom
|
|
61
|
-
- Keyboard Control
|
|
62
|
-
- Mousewheel Control
|
|
63
|
-
- Hash Navigation
|
|
64
|
-
- History Navigation
|
|
65
|
-
- Controller
|
|
66
|
-
- Accessibility (a11y)
|
|
67
|
-
|
|
68
|
-
**Not Supported**
|
|
69
|
-
|
|
70
|
-
- Creative Effect
|
|
71
|
-
- Virtual Slides
|
|
84
|
+
Once loaded, the console prints `🚿 Hello from Wellspring Waterfall vX.Y.Z`, so you can confirm which version is running.
|
|
72
85
|
|
|
73
86
|
## Usage
|
|
74
87
|
|
|
75
|
-
**Use the
|
|
76
|
-
This is the easiest way to manage Waterfall. The App
|
|
88
|
+
**Use the Wellspring App**
|
|
89
|
+
This is the easiest way to manage Waterfall. The App lets you create, edit, and modify existing Waterfalls through a convenient interface inside the Designer.
|
|
77
90
|
|
|
78
|
-
|
|
91
|
+
**Add attributes manually**
|
|
92
|
+
Every setting is a plain HTML attribute, so you can also add them yourself in Webflow under **Element Settings → Custom Attributes**. See the [Attribute Reference](#attribute-reference) below.
|
|
79
93
|
|
|
80
94
|
## Waterfall Layout
|
|
81
95
|
|
|
82
|
-
|
|
96
|
+
Waterfall uses the standard SwiperJS markup with an added wrapper element that carries the `waterfall` attribute. Each Waterfall is identified by `[waterfall="SWIPER_NAME"]`, where `SWIPER_NAME` is a unique string. The name is also used to link sliders together (thumbs, controller) and to target them from outside (slide manipulation).
|
|
83
97
|
|
|
84
|
-
```
|
|
85
|
-
<!--
|
|
86
|
-
<div waterfall="SWIPER_NAME"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
...
|
|
93
|
-
</div>
|
|
98
|
+
```html
|
|
99
|
+
<!-- Waterfall wrapper: all settings attributes go here -->
|
|
100
|
+
<div waterfall="SWIPER_NAME" waterfall-slides-per-view="3" waterfall-space-between="24">
|
|
101
|
+
<div class="swiper">
|
|
102
|
+
<div class="swiper-wrapper">
|
|
103
|
+
<div class="swiper-slide">Slide 1</div>
|
|
104
|
+
<div class="swiper-slide">Slide 2</div>
|
|
105
|
+
<div class="swiper-slide">Slide 3</div>
|
|
94
106
|
</div>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<!-- Optional elements (anywhere inside the wrapper) -->
|
|
110
|
+
<div waterfall-el="pagination"></div>
|
|
111
|
+
<button waterfall-el="navigation-prev">Prev</button>
|
|
112
|
+
<button waterfall-el="navigation-next">Next</button>
|
|
113
|
+
<div waterfall-el="scrollbar"><div waterfall-el="scrollbar-drag"></div></div>
|
|
95
114
|
</div>
|
|
96
115
|
```
|
|
97
116
|
|
|
98
|
-
|
|
117
|
+
Waterfalls initialize on `DOMContentLoaded`.
|
|
118
|
+
|
|
119
|
+
**Webflow CMS:** A Collection List works as a slider when you give the Collection List Wrapper the `swiper` class, the Collection List the `swiper-wrapper` class, and each Collection Item the `swiper-slide` class.
|
|
120
|
+
|
|
121
|
+
## How Attributes Work
|
|
122
|
+
|
|
123
|
+
- **Placement.** Unless noted otherwise, attributes go on the `[waterfall]` wrapper element.
|
|
124
|
+
- **Naming.** Each attribute is named after its SwiperJS parameter in kebab-case with a `waterfall-` prefix. Example: `direction` → `waterfall-direction`. Parameters inside an object include the group name: `freeMode.enabled` → `waterfall-free-mode-enabled`. A few attributes use shorter names; the tables below list the exact names.
|
|
125
|
+
- **Value types.**
|
|
126
|
+
- `boolean`: the literal text `true` or `false`. Any other value is ignored.
|
|
127
|
+
- `number`: a plain number without units (`24`, not `24px`).
|
|
128
|
+
- `string`: text, used as-is (surrounding whitespace is trimmed).
|
|
129
|
+
- **Defaults.** Leaving an attribute out, or setting it to its default value, falls back to the SwiperJS default shown in the tables.
|
|
130
|
+
- **Debugging.** Add `waterfall-debug-mode="true"` to log the generated Swiper config, the elements found, and linking details to the console.
|
|
131
|
+
|
|
132
|
+
The attribute names are also exported as constants from `src/lib/attributes.ts` and `src/lib/elements.ts`.
|
|
133
|
+
|
|
134
|
+
## Attribute Reference
|
|
135
|
+
|
|
136
|
+
### Core
|
|
137
|
+
|
|
138
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
139
|
+
| ------------------------- | -------------- | ------- | ------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
|
140
|
+
| `waterfall` | — | string | _(required)_ | Unique name for this slider. Marks the element as a Waterfall. |
|
|
141
|
+
| `waterfall-debug-mode` | — | boolean | `false` | Logs the generated config and initialization details to the console. |
|
|
142
|
+
| `waterfall-initial-slide` | `initialSlide` | number | `0` | Index of the slide to show first. |
|
|
143
|
+
| `waterfall-nested` | `nested` | boolean | `false` | Set to `true` on a Swiper nested inside another Swiper with the same direction, so touch events are captured correctly. |
|
|
144
|
+
|
|
145
|
+
### Layout
|
|
146
|
+
|
|
147
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
148
|
+
| -------------------------------------- | -------------------------- | -------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------- |
|
|
149
|
+
| `waterfall-direction` | `direction` | `horizontal` \| `vertical` | `horizontal` | Slide direction. |
|
|
150
|
+
| `waterfall-slides-per-view` | `slidesPerView` | number \| `auto` | `1` | Number of slides visible at once. Decimals like `1.5` show partial slides; `auto` uses each slide's CSS width. |
|
|
151
|
+
| `waterfall-slides-per-group` | `slidesPerGroup` | number | `1` | Number of slides to advance per navigation step. |
|
|
152
|
+
| `waterfall-slides-per-group-skip` | `slidesPerGroupSkip` | number | `0` | Number of initial slides that advance one at a time before grouping starts. |
|
|
153
|
+
| `waterfall-slides-per-group-auto` | `slidesPerGroupAuto` | boolean | `false` | With `slidesPerView: auto`, advances by the number of slides currently visible. |
|
|
154
|
+
| `waterfall-space-between` | `spaceBetween` | number (px) | `0` | Gap between slides. |
|
|
155
|
+
| `waterfall-centered-slides` | `centeredSlides` | boolean | `false` | Centers the active slide instead of aligning it to the left or top. |
|
|
156
|
+
| `waterfall-center-insufficient-slides` | `centerInsufficientSlides` | boolean | `false` | Centers the slides when there are fewer than `slidesPerView`. |
|
|
157
|
+
| `waterfall-normalize-slide-index` | `normalizeSlideIndex` | boolean | `true` | Normalizes the active slide index when using `slidesPerGroup`. |
|
|
158
|
+
| `waterfall-auto-height` | `autoHeight` | boolean | `false` | Resizes the slider height to match the active slide. |
|
|
159
|
+
| `waterfall-slides-offset-before` | `slidesOffsetBefore` | number (px) | `0` | Extra space before the first slide. |
|
|
160
|
+
| `waterfall-slides-offset-after` | `slidesOffsetAfter` | number (px) | `0` | Extra space after the last slide. |
|
|
161
|
+
| `waterfall-width` | `width` | number (px) | — | Forces a slider width. Useful only when the slider is hidden on init. |
|
|
162
|
+
| `waterfall-height` | `height` | number (px) | — | Forces a slider height. Useful only when the slider is hidden on init. |
|
|
163
|
+
|
|
164
|
+
### Responsive Breakpoints
|
|
165
|
+
|
|
166
|
+
Breakpoints match Webflow's breakpoints and cascade the same way Webflow styles do: outward from Desktop. A value set on Tablet also applies to Mobile Landscape and Mobile Portrait unless they override it, and a value set on Desktop also applies to 1280px and 1440px. Anywhere no breakpoint value applies, the base attribute (e.g. `waterfall-slides-per-view`) is used.
|
|
167
|
+
|
|
168
|
+
| Suffix | Webflow breakpoint | Applies to | Falls back to |
|
|
169
|
+
| ---------------- | ------------------ | --------------- | ---------------------------------- |
|
|
170
|
+
| `-mobile` | Mobile portrait | 479px and below | `-mobile-large`, `-tablet`, base |
|
|
171
|
+
| `-mobile-large` | Mobile landscape | 480px – 767px | `-tablet`, base |
|
|
172
|
+
| `-tablet` | Tablet | 768px – 991px | base |
|
|
173
|
+
| `-desktop` | Desktop | 992px and up | base |
|
|
174
|
+
| `-desktop-small` | 1280px | 1280px and up | `-desktop`, base |
|
|
175
|
+
| `-desktop-large` | 1440px | 1440px and up | `-desktop-small`, `-desktop`, base |
|
|
176
|
+
|
|
177
|
+
| Attribute pattern | Swiper option | Values | Description |
|
|
178
|
+
| ----------------------------------------- | ----------------- | ----------------------- | ------------------------------------------------------------------------------------------------- |
|
|
179
|
+
| `waterfall-slides-per-view-{breakpoint}` | `slidesPerView` | number | Slides visible at this breakpoint, or `auto`. |
|
|
180
|
+
| `waterfall-slides-per-group-{breakpoint}` | `slidesPerGroup` | number | Slides advanced per step at this breakpoint. |
|
|
181
|
+
| `waterfall-space-between-{breakpoint}` | `spaceBetween` | number (px) | Gap between slides at this breakpoint. |
|
|
182
|
+
| `waterfall-centered-slides-{breakpoint}` | `centeredSlides` | boolean | Centers the active slide at this breakpoint. |
|
|
183
|
+
| `waterfall-breakpoints-base` | `breakpointsBase` | `window` \| `container` | Measures breakpoints against the window width (default `window`) or the slider container's width. |
|
|
184
|
+
|
|
185
|
+
Example: `waterfall-slides-per-view="3"` + `waterfall-slides-per-view-tablet="2"` + `waterfall-slides-per-view-mobile-large="1"` shows 3 slides on Desktop and up, 2 on Tablet, and 1 on both mobile breakpoints.
|
|
186
|
+
|
|
187
|
+
### Playback (Loop, Rewind, Speed)
|
|
188
|
+
|
|
189
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
190
|
+
| ---------------------------------- | ---------------------- | ---------------------------- | ------- | --------------------------------------------------------------------------------------------------- |
|
|
191
|
+
| `waterfall-playback-mode` | `loop` / `rewind` | `none` \| `loop` \| `rewind` | `none` | `loop` wraps around endlessly. `rewind` jumps back to the first slide after the last one. |
|
|
192
|
+
| `waterfall-speed` | `speed` | number (ms) | `300` | Transition duration between slides. |
|
|
193
|
+
| `waterfall-loop-add-blank-slides` | `loopAddBlankSlides` | boolean | `true` | With loop and grid/`slidesPerGroup`, adds blank slides when the slide count isn't evenly divisible. |
|
|
194
|
+
| `waterfall-loop-additional-slides` | `loopAdditionalSlides` | number | `0` | Extra slides to clone for looping. |
|
|
195
|
+
| `waterfall-loop-prevents-sliding` | `loopPreventsSliding` | boolean | `true` | Blocks navigation while the loop is repositioning slides. |
|
|
196
|
+
| `waterfall-data-one-way-movement` | `oneWayMovement` | boolean | `false` | Swiping in either direction advances to the next slide. |
|
|
197
|
+
|
|
198
|
+
### Autoplay
|
|
199
|
+
|
|
200
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
201
|
+
| ---------------------------------- | ------------------------------- | ----------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
202
|
+
| `waterfall-autoplay-mode` | `autoplay` | boolean | `false` | Turns autoplay on. The other autoplay attributes apply only when this is `true`. |
|
|
203
|
+
| `waterfall-delay` | `autoplay.delay` | number (ms) | `3000` | Time between transitions. |
|
|
204
|
+
| `waterfall-smooth-autoplay` | — | boolean | `false` | Continuous "marquee" scrolling: sets the delay to `0` and applies linear easing to `.swiper-wrapper`. Pair it with a high `waterfall-speed` (e.g. `5000`). |
|
|
205
|
+
| `waterfall-disable-on-interaction` | `autoplay.disableOnInteraction` | boolean | `false` | Stops autoplay permanently after the user interacts with the slider. |
|
|
206
|
+
| `waterfall-pause-on-mouse-enter` | `autoplay.pauseOnMouseEnter` | boolean | `false` | Pauses while the pointer is over the slider. |
|
|
207
|
+
| `waterfall-reverse-direction` | `autoplay.reverseDirection` | boolean | `false` | Autoplays backwards. |
|
|
208
|
+
| `waterfall-stop-on-last-slide` | `autoplay.stopOnLastSlide` | boolean | `false` | Stops on the last slide. Has no effect in loop mode. |
|
|
209
|
+
|
|
210
|
+
### Autoplay Control Button
|
|
211
|
+
|
|
212
|
+
A play/pause toggle for autoplaying sliders. It requires `waterfall-autoplay-mode="true"` and all three [elements](#element-reference) (`autoplay-control`, `autoplay-control-play`, `autoplay-control-pause`) inside the wrapper. The button shows the pause icon while playing and the play icon while paused.
|
|
213
|
+
|
|
214
|
+
| Attribute | Values | Default | Description |
|
|
215
|
+
| ------------------------------------------ | --------------------- | --------- | ------------------------------------------------------- |
|
|
216
|
+
| `waterfall-autoplay-control-enabled` | boolean | `false` | Turns on the play/pause button. |
|
|
217
|
+
| `waterfall-autoplay-control-default-state` | `playing` \| `paused` | `playing` | Whether autoplay starts running or paused on page load. |
|
|
218
|
+
|
|
219
|
+
### Navigation
|
|
220
|
+
|
|
221
|
+
Navigation turns on automatically when a `navigation-next` or `navigation-prev` [element](#element-reference) is found inside the wrapper.
|
|
222
|
+
|
|
223
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
224
|
+
| ------------------------------------------------ | ------------------------------------ | ------- | ---------------------------- | ----------------------------------------------------------------- |
|
|
225
|
+
| `waterfall-navigation-enabled` | `navigation.enabled` | boolean | _(auto)_ | Set to `false` to turn navigation off even when buttons exist. |
|
|
226
|
+
| `waterfall-navigation-hide-on-click` | `navigation.hideOnClick` | boolean | `false` | Toggles button visibility when the slider is clicked. |
|
|
227
|
+
| `waterfall-allow-slide-next` | `allowSlideNext` | boolean | `true` | Set to `false` to block sliding forward. |
|
|
228
|
+
| `waterfall-allow-slide-prev` | `allowSlidePrev` | boolean | `true` | Set to `false` to block sliding backward. |
|
|
229
|
+
| `waterfall-navigation-disabled-class` | `navigation.disabledClass` | string | `swiper-button-disabled` | Class added to a button when it can't be used (first/last slide). |
|
|
230
|
+
| `waterfall-navigation-hidden-class` | `navigation.hiddenClass` | string | `swiper-button-hidden` | Class added to hidden buttons. |
|
|
231
|
+
| `waterfall-navigation-lock-class` | `navigation.lockClass` | string | `swiper-button-lock` | Class added when navigation is locked (not enough slides). |
|
|
232
|
+
| `waterfall-navigation-navigation-disabled-class` | `navigation.navigationDisabledClass` | string | `swiper-navigation-disabled` | Class added to the container when navigation is disabled. |
|
|
233
|
+
|
|
234
|
+
### Pagination
|
|
235
|
+
|
|
236
|
+
Pagination turns on when a `pagination` [element](#element-reference) is found inside the wrapper. To style bullets in Webflow, add a `pagination-bullet` element: Waterfall copies its tag name and classes onto every generated bullet.
|
|
237
|
+
|
|
238
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
239
|
+
| ------------------------------------------------- | ------------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
240
|
+
| `waterfall-pagination-type` | `pagination.type` | `bullets` \| `numberBullets` \| `fraction` \| `progressbar` \| `custom` | `bullets` | Pagination style. `numberBullets` shows bullets containing the slide number. |
|
|
241
|
+
| `waterfall-pagination-enabled` | `pagination.enabled` | boolean | _(auto)_ | Set to `false` to turn pagination off even when the element exists. |
|
|
242
|
+
| `waterfall-pagination-clickable` | `pagination.clickable` | boolean | `false` | Clicking a bullet goes to that slide. |
|
|
243
|
+
| `waterfall-pagination-dynamic-bullets` | `pagination.dynamicBullets` | boolean | `false` | Shows only a few bullets at a time; useful with many slides. |
|
|
244
|
+
| `waterfall-pagination-dynamic-main-bullets` | `pagination.dynamicMainBullets` | number | `1` | Number of main bullets shown with dynamic bullets. |
|
|
245
|
+
| `waterfall-pagination-hide-on-click` | `pagination.hideOnClick` | boolean | `false` | Toggles pagination visibility when the slider is clicked. |
|
|
246
|
+
| `waterfall-pagination-progressbar-opposite` | `pagination.progressbarOpposite` | boolean | `false` | Draws the progress bar in the opposite direction to the slider (e.g. vertical on a horizontal slider). |
|
|
247
|
+
| `waterfall-pagination-bullet-active-class` | `pagination.bulletActiveClass` | string | `swiper-pagination-bullet-active` | Class on the active bullet. |
|
|
248
|
+
| `waterfall-pagination-clickable-class` | `pagination.clickableClass` | string | `swiper-pagination-clickable` | Class added when pagination is clickable. |
|
|
249
|
+
| `waterfall-pagination-current-class` | `pagination.currentClass` | string | `swiper-pagination-current` | Class on the current number in `fraction` pagination. |
|
|
250
|
+
| `waterfall-pagination-total-class` | `pagination.totalClass` | string | `swiper-pagination-total` | Class on the total number in `fraction` pagination. |
|
|
251
|
+
| `waterfall-pagination-hidden-class` | `pagination.hiddenClass` | string | `swiper-pagination-hidden` | Class added when pagination is hidden. |
|
|
252
|
+
| `waterfall-pagination-horizontal-class` | `pagination.horizontalClass` | string | `swiper-pagination-horizontal` | Class added for horizontal sliders. |
|
|
253
|
+
| `waterfall-pagination-vertical-class` | `pagination.verticalClass` | string | `swiper-pagination-vertical` | Class added for vertical sliders. |
|
|
254
|
+
| `waterfall-pagination-lock-class` | `pagination.lockClass` | string | `swiper-pagination-lock` | Class added when pagination is locked (not enough slides). |
|
|
255
|
+
| `waterfall-pagination-modifier-class` | `pagination.modifierClass` | string | `swiper-pagination-` | Prefix for the type modifier class (e.g. `swiper-pagination-bullets`). |
|
|
256
|
+
| `waterfall-pagination-pagination-disabled-class` | `pagination.paginationDisabledClass` | string | `swiper-pagination-disabled` | Class added when pagination is disabled. |
|
|
257
|
+
| `waterfall-pagination-progressbar-fill-class` | `pagination.progressbarFillClass` | string | `swiper-pagination-progressbar-fill` | Class on the progress bar fill. |
|
|
258
|
+
| `waterfall-pagination-progressbar-opposite-class` | `pagination.progressbarOppositeClass` | string | `swiper-pagination-progressbar-opposite` | Class added with an opposite progress bar. |
|
|
259
|
+
|
|
260
|
+
### Scrollbar
|
|
261
|
+
|
|
262
|
+
The scrollbar turns on when a `scrollbar` [element](#element-reference) is found inside the wrapper. The drag handle's class is taken from the `scrollbar-drag` element inside it.
|
|
263
|
+
|
|
264
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
265
|
+
| ---------------------------------------------- | ---------------------------------- | --------------------- | ----------------------------- | ---------------------------------------------------------------------- |
|
|
266
|
+
| `waterfall-scrollbar-enabled` | `scrollbar.enabled` | boolean | _(auto)_ | Set to `false` to turn the scrollbar off even when the element exists. |
|
|
267
|
+
| `waterfall-scrollbar-draggable` | `scrollbar.draggable` | boolean | `false` | Lets the user drag the scrollbar handle. |
|
|
268
|
+
| `waterfall-scrollbar-hide` | `scrollbar.hide` | boolean | `false` | Hides the scrollbar after the user stops interacting. |
|
|
269
|
+
| `waterfall-scrollbar-snap-on-release` | `scrollbar.snapOnRelease` | boolean | `true` | Snaps to the nearest slide when the handle is released. |
|
|
270
|
+
| `waterfall-scrollbar-drag-size` | `scrollbar.dragSize` | number (px) \| `auto` | `auto` | Size of the drag handle. |
|
|
271
|
+
| `waterfall-scrollbar-horizontal-class` | `scrollbar.horizontalClass` | string | `swiper-scrollbar-horizontal` | Class added for horizontal sliders. |
|
|
272
|
+
| `waterfall-scrollbar-vertical-class` | `scrollbar.verticalClass` | string | `swiper-scrollbar-vertical` | Class added for vertical sliders. |
|
|
273
|
+
| `waterfall-scrollbar-lock-class` | `scrollbar.lockClass` | string | `swiper-scrollbar-lock` | Class added when the scrollbar is locked (not enough slides). |
|
|
274
|
+
| `waterfall-scrollbar-scrollbar-disabled-class` | `scrollbar.scrollbarDisabledClass` | string | `swiper-scrollbar-disabled` | Class added when the scrollbar is disabled. |
|
|
275
|
+
|
|
276
|
+
### Effects
|
|
277
|
+
|
|
278
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
279
|
+
| ------------------ | ------------- | --------------------------------------------------------------- | ------- | ------------------------------------------------------------ |
|
|
280
|
+
| `waterfall-effect` | `effect` | `slide` \| `fade` \| `cube` \| `coverflow` \| `flip` \| `cards` | `slide` | Transition effect. `fade` always cross-fades between slides. |
|
|
281
|
+
|
|
282
|
+
The settings below apply only when the matching effect is selected.
|
|
283
|
+
|
|
284
|
+
**Coverflow** (`waterfall-effect="coverflow"`)
|
|
285
|
+
|
|
286
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
287
|
+
| ----------------------------------- | ------------------------------ | ------------ | ------- | ------------------------------------------------- |
|
|
288
|
+
| `waterfall-coverflow-rotate` | `coverflowEffect.rotate` | number (deg) | `50` | Rotation of the side slides. |
|
|
289
|
+
| `waterfall-coverflow-stretch` | `coverflowEffect.stretch` | number (px) | `0` | Space between slides. |
|
|
290
|
+
| `waterfall-coverflow-depth` | `coverflowEffect.depth` | number (px) | `100` | Depth offset (Z translation). |
|
|
291
|
+
| `waterfall-coverflow-scale` | `coverflowEffect.scale` | number | `1` | Scale of the side slides. |
|
|
292
|
+
| `waterfall-coverflow-modifier` | `coverflowEffect.modifier` | number | `1` | Multiplier applied to rotate, depth, and stretch. |
|
|
293
|
+
| `waterfall-coverflow-slide-shadows` | `coverflowEffect.slideShadows` | boolean | `true` | Shows shadows on the slides. |
|
|
294
|
+
|
|
295
|
+
**Cube** (`waterfall-effect="cube"`)
|
|
296
|
+
|
|
297
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
298
|
+
| ------------------------------ | ------------------------- | ----------- | ------- | ------------------------------------- |
|
|
299
|
+
| `waterfall-cube-shadow` | `cubeEffect.shadow` | boolean | `true` | Shows the main shadow under the cube. |
|
|
300
|
+
| `waterfall-cube-shadow-offset` | `cubeEffect.shadowOffset` | number (px) | `20` | Offset of the main shadow. |
|
|
301
|
+
| `waterfall-cube-shadow-scale` | `cubeEffect.shadowScale` | number | `0.94` | Scale of the main shadow. |
|
|
302
|
+
| `waterfall-cube-slide-shadows` | `cubeEffect.slideShadows` | boolean | `true` | Shows shadows on the slides. |
|
|
303
|
+
|
|
304
|
+
**Flip** (`waterfall-effect="flip"`)
|
|
305
|
+
|
|
306
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
307
|
+
| ------------------------------- | -------------------------- | ------- | ------- | --------------------------------------- |
|
|
308
|
+
| `waterfall-flip-limit-rotation` | `flipEffect.limitRotation` | boolean | `true` | Limits the rotation of the edge slides. |
|
|
309
|
+
| `waterfall-flip-slide-shadows` | `flipEffect.slideShadows` | boolean | `true` | Shows shadows on the slides. |
|
|
310
|
+
|
|
311
|
+
**Cards** (`waterfall-effect="cards"`)
|
|
312
|
+
|
|
313
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
314
|
+
| ---------------------------------- | ---------------------------- | ------------ | ------- | ------------------------------ |
|
|
315
|
+
| `waterfall-cards-per-slide-offset` | `cardsEffect.perSlideOffset` | number (px) | `8` | Offset between stacked cards. |
|
|
316
|
+
| `waterfall-cards-per-slide-rotate` | `cardsEffect.perSlideRotate` | number (deg) | `2` | Rotation of each stacked card. |
|
|
317
|
+
| `waterfall-cards-rotate` | `cardsEffect.rotate` | boolean | `true` | Rotates the cards. |
|
|
318
|
+
| `waterfall-cards-slide-shadows` | `cardsEffect.slideShadows` | boolean | `true` | Shows shadows on the cards. |
|
|
319
|
+
|
|
320
|
+
### Free Mode
|
|
321
|
+
|
|
322
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
323
|
+
| --------------------------------------------- | -------------------------------- | ------- | ------- | -------------------------------------------------------- |
|
|
324
|
+
| `waterfall-free-mode-enabled` | `freeMode.enabled` | boolean | `false` | Slides move freely without snapping to positions. |
|
|
325
|
+
| `waterfall-free-mode-sticky` | `freeMode.sticky` | boolean | `false` | Snaps to the nearest slide once the momentum ends. |
|
|
326
|
+
| `waterfall-free-mode-momentum` | `freeMode.momentum` | boolean | `true` | Slides keep moving after release. |
|
|
327
|
+
| `waterfall-free-mode-momentum-ratio` | `freeMode.momentumRatio` | number | `1` | Higher values increase the momentum distance. |
|
|
328
|
+
| `waterfall-free-mode-momentum-velocity-ratio` | `freeMode.momentumVelocityRatio` | number | `1` | Higher values increase the momentum speed. |
|
|
329
|
+
| `waterfall-free-mode-momentum-bounce` | `freeMode.momentumBounce` | boolean | `true` | Bounces at the edges after momentum. |
|
|
330
|
+
| `waterfall-free-mode-momentum-bounce-ratio` | `freeMode.momentumBounceRatio` | number | `1` | Higher values increase the bounce effect. |
|
|
331
|
+
| `waterfall-free-mode-minimum-velocity` | `freeMode.minimumVelocity` | number | `0.02` | Minimum touchmove velocity required to trigger momentum. |
|
|
332
|
+
|
|
333
|
+
### Grid
|
|
334
|
+
|
|
335
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
336
|
+
| --------------------- | ------------- | ----------------- | -------- | --------------------------------------------------- |
|
|
337
|
+
| `waterfall-grid-rows` | `grid.rows` | number | `1` | Number of slide rows. Works best without loop mode. |
|
|
338
|
+
| `waterfall-grid-fill` | `grid.fill` | `row` \| `column` | `column` | Whether slides fill the grid by row or by column. |
|
|
339
|
+
|
|
340
|
+
### Thumbs
|
|
341
|
+
|
|
342
|
+
Links a main slider to a separate thumbnail slider. Add the attributes to the **main** slider; the value of `waterfall-thumbs` is the name of the thumbnail Waterfall. Waterfall initializes the thumbnail slider first, so the order of the sliders on the page doesn't matter.
|
|
343
|
+
|
|
344
|
+
```html
|
|
345
|
+
<div waterfall="gallery" waterfall-thumbs="gallery-thumbs">…</div>
|
|
346
|
+
<div waterfall="gallery-thumbs" waterfall-slides-per-view="4" waterfall-watch-slides-progress="true">…</div>
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
350
|
+
| ----------------------------------------- | ------------------------------ | -------------- | --------------------------- | -------------------------------------------------------------------------------------------- |
|
|
351
|
+
| `waterfall-thumbs` | `thumbs.swiper` | Waterfall name | — | Name of the thumbnail slider to link. |
|
|
352
|
+
| `waterfall-thumbs-auto-scroll-offset` | `thumbs.autoScrollOffset` | number | `0` | Offset from the edge at which the thumbnail slider scrolls to keep the active thumb visible. |
|
|
353
|
+
| `waterfall-thumbs-multiple-active-thumbs` | `thumbs.multipleActiveThumbs` | boolean | `true` | With multiple slides per view, highlights every thumb that is visible in the main slider. |
|
|
354
|
+
| `waterfall-slide-thumb-active-class` | `thumbs.slideThumbActiveClass` | string | `swiper-slide-thumb-active` | Class added to the active thumbnail. |
|
|
355
|
+
| `waterfall-thumbs-container-class` | `thumbs.thumbsContainerClass` | string | `swiper-thumbs` | Class added to the thumbnail slider container. |
|
|
356
|
+
|
|
357
|
+
### Controller
|
|
358
|
+
|
|
359
|
+
Makes one slider drive another. The value of `waterfall-controller` is the name of the Waterfall to control. The controlled slider is initialized first. For two-way sync, add `waterfall-controller` to both sliders.
|
|
360
|
+
|
|
361
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
362
|
+
| ------------------------------ | -------------------- | ---------------------- | ------- | -------------------------------------------------------------------------------- |
|
|
363
|
+
| `waterfall-controller` | `controller.control` | Waterfall name | — | Name of the slider to control. |
|
|
364
|
+
| `waterfall-controller-by` | `controller.by` | `slide` \| `container` | `slide` | Syncs by slide index (`slide`) or by proportional scroll position (`container`). |
|
|
365
|
+
| `waterfall-controller-inverse` | `controller.inverse` | boolean | `false` | Moves the controlled slider in the opposite direction. |
|
|
366
|
+
|
|
367
|
+
### Touch & Swiping
|
|
368
|
+
|
|
369
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
370
|
+
| --------------------------------------------- | -------------------------------- | ------------------------ | ------------------------------------------------------- | --------------------------------------------------------------------------------- |
|
|
371
|
+
| `waterfall-allow-touch-move` | `allowTouchMove` | boolean | `true` | Set to `false` to turn off swiping; only navigation and pagination remain. |
|
|
372
|
+
| `waterfall-simulate-touch` | `simulateTouch` | boolean | `true` | Lets desktop users drag slides with the mouse. |
|
|
373
|
+
| `waterfall-grab-cursor` | `grabCursor` | boolean | `false` | Shows a "grab" cursor on hover. |
|
|
374
|
+
| `waterfall-follow-finger` | `followFinger` | boolean | `true` | Slides follow the finger during a swipe. When `false`, they move only on release. |
|
|
375
|
+
| `waterfall-slide-to-clicked-slide` | `slideToClickedSlide` | boolean | `false` | Clicking a slide transitions to it. |
|
|
376
|
+
| `waterfall-threshold` | `threshold` | number (px) | `5` | Minimum drag distance before a swipe starts. |
|
|
377
|
+
| `waterfall-touch-ratio` | `touchRatio` | number | `1` | Touch sensitivity multiplier. |
|
|
378
|
+
| `waterfall-touch-angle` | `touchAngle` | number (deg) | `45` | Maximum angle at which a touch counts as a swipe. |
|
|
379
|
+
| `waterfall-short-swipes` | `shortSwipes` | boolean | `true` | Allows quick, short swipes to change slides. |
|
|
380
|
+
| `waterfall-long-swipes` | `longSwipes` | boolean | `true` | Allows long swipes to change slides. |
|
|
381
|
+
| `waterfall-long-swipes-ms` | `longSwipesMs` | number (ms) | `300` | Minimum duration for a long swipe. |
|
|
382
|
+
| `waterfall-long-swipes-ratio` | `longSwipesRatio` | number | `0.5` | Fraction of the slide width a long swipe must cover to change slides. |
|
|
383
|
+
| `waterfall-resistance` | `resistance` | boolean | `true` | Adds rubber-band resistance at the edges. |
|
|
384
|
+
| `waterfall-resistance-ratio` | `resistanceRatio` | number | `0.85` | Strength of edge resistance. |
|
|
385
|
+
| `waterfall-edge-swipe-detection` | `edgeSwipeDetection` | boolean | `false` | Releases touches near the screen edge so the browser's back/forward swipe works. |
|
|
386
|
+
| `waterfall-edge-swipe-threshold` | `edgeSwipeThreshold` | number (px) | `20` | Width of the edge area used for edge swipe detection. |
|
|
387
|
+
| `waterfall-touch-events-target` | `touchEventsTarget` | `wrapper` \| `container` | `wrapper` | Element that listens for touch events. |
|
|
388
|
+
| `waterfall-touch-move-stop-propagation` | `touchMoveStopPropagation` | boolean | `false` | Stops `touchmove` events from propagating. |
|
|
389
|
+
| `waterfall-touch-release-on-edges` | `touchReleaseOnEdges` | boolean | `false` | Releases touch events at the slider edges so the page can scroll. |
|
|
390
|
+
| `waterfall-touch-start-prevent-default` | `touchStartPreventDefault` | boolean | `true` | Prevents default on `pointerdown` (blocks text selection while dragging). |
|
|
391
|
+
| `waterfall-touch-start-force-prevent-default` | `touchStartForcePreventDefault` | boolean | `false` | Always prevents default on `touchstart`. |
|
|
392
|
+
| `waterfall-prevent-clicks` | `preventClicks` | boolean | `true` | Prevents accidental link clicks while swiping. |
|
|
393
|
+
| `waterfall-prevent-clicks-propagation` | `preventClicksPropagation` | boolean | `true` | Stops click events from propagating while swiping. |
|
|
394
|
+
| `waterfall-prevent-interaction-on-transition` | `preventInteractionOnTransition` | boolean | `false` | Blocks interaction while a transition is running. |
|
|
395
|
+
| `waterfall-no-swiping` | `noSwiping` | boolean | `true` | Turns on swipe blocking for elements matching the no-swiping class or selector. |
|
|
396
|
+
| `waterfall-no-swiping-class` | `noSwipingClass` | string | `swiper-no-swiping` | Swiping is blocked on elements with this class. |
|
|
397
|
+
| `waterfall-no-swiping-selector` | `noSwipingSelector` | CSS selector | — | Swiping is blocked on elements matching this selector (overrides the class). |
|
|
398
|
+
| `waterfall-focusable-elements` | `focusableElements` | CSS selector | `input, select, option, textarea, button, video, label` | Elements that keep native focus behavior instead of starting a swipe. |
|
|
399
|
+
| `waterfall-swipe-handler` | `swipeHandler` | CSS selector | — | Restricts swiping to this handle element. |
|
|
400
|
+
|
|
401
|
+
### Keyboard Control
|
|
402
|
+
|
|
403
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
404
|
+
| ------------------------------------- | ------------------------- | ------- | ------- | ---------------------------------------------------------- |
|
|
405
|
+
| `waterfall-keyboard-enabled` | `keyboard.enabled` | boolean | `false` | Arrow keys control the slider. |
|
|
406
|
+
| `waterfall-keyboard-only-in-viewport` | `keyboard.onlyInViewport` | boolean | `true` | Responds to keys only while the slider is in the viewport. |
|
|
407
|
+
| `waterfall-keyboard-page-up-down` | `keyboard.pageUpDown` | boolean | `true` | Page Up / Page Down also navigate. |
|
|
408
|
+
|
|
409
|
+
### Mousewheel Control
|
|
410
|
+
|
|
411
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
412
|
+
| -------------------------------------- | ------------------------------ | ---------------------------------------- | ---------------------- | --------------------------------------------------------------------- |
|
|
413
|
+
| `waterfall-mouse-enabled` | `mousewheel.enabled` | boolean | `false` | The mouse wheel controls the slider. |
|
|
414
|
+
| `waterfall-mouse-force-to-axis` | `mousewheel.forceToAxis` | boolean | `false` | Only responds to wheel movement along the slider's direction. |
|
|
415
|
+
| `waterfall-mouse-invert` | `mousewheel.invert` | boolean | `false` | Inverts the scroll direction. |
|
|
416
|
+
| `waterfall-mouse-release-on-edges` | `mousewheel.releaseOnEdges` | boolean | `false` | Lets the page scroll once the slider reaches its first or last slide. |
|
|
417
|
+
| `waterfall-mouse-sensitivity` | `mousewheel.sensitivity` | number | `1` | Wheel sensitivity multiplier. |
|
|
418
|
+
| `waterfall-mouse-threshold-delta` | `mousewheel.thresholdDelta` | number | — | Minimum wheel delta needed to trigger a slide change. |
|
|
419
|
+
| `waterfall-mouse-threshold-time` | `mousewheel.thresholdTime` | number (ms) | — | Minimum time between wheel-triggered slide changes. |
|
|
420
|
+
| `waterfall-mouse-events-target` | `mousewheel.eventsTarget` | `container` \| `wrapper` \| CSS selector | `container` | Element that listens for wheel events. |
|
|
421
|
+
| `waterfall-mouse-no-mouse-wheel-class` | `mousewheel.noMousewheelClass` | string | `swiper-no-mousewheel` | The mouse wheel is ignored over elements with this class. |
|
|
422
|
+
|
|
423
|
+
### Hash Navigation
|
|
424
|
+
|
|
425
|
+
Syncs the active slide with the URL hash. Add `data-hash="my-slide"` to each slide. Setting either attribute below to `true` turns hash navigation on.
|
|
426
|
+
|
|
427
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
428
|
+
| ------------------------------ | ----------------------------- | ------- | ------- | ---------------------------------------------------------------------- |
|
|
429
|
+
| `waterfall-hash-watch-state` | `hashNavigation.watchState` | boolean | `false` | Changes slides when the hash changes (e.g. browser back/forward). |
|
|
430
|
+
| `waterfall-hash-replace-state` | `hashNavigation.replaceState` | boolean | `false` | Replaces the history entry instead of adding a new one on each change. |
|
|
431
|
+
|
|
432
|
+
### History Navigation
|
|
433
|
+
|
|
434
|
+
Syncs the active slide with the URL path (e.g. `/slides/my-slide`). Add `data-history="my-slide"` to each slide. Setting any attribute below to a non-default value turns history navigation on.
|
|
435
|
+
|
|
436
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
437
|
+
| --------------------------------- | ---------------------- | ------- | -------- | ------------------------------------------------------- |
|
|
438
|
+
| `waterfall-history-key` | `history.key` | string | `slides` | URL segment placed before the slide name. |
|
|
439
|
+
| `waterfall-history-root` | `history.root` | string | `""` | Base URL path for history entries. |
|
|
440
|
+
| `waterfall-history-replace-state` | `history.replaceState` | boolean | `false` | Replaces the history entry instead of adding a new one. |
|
|
441
|
+
| `waterfall-history-keep-query` | `history.keepQuery` | boolean | `false` | Keeps the URL query parameters when the URL is updated. |
|
|
442
|
+
|
|
443
|
+
### Zoom
|
|
444
|
+
|
|
445
|
+
Double-tap or pinch to zoom. Wrap each slide's image in `<div class="swiper-zoom-container">`. Setting any attribute below to a non-default value turns zoom on (e.g. `waterfall-zoom-max-ratio="4"`).
|
|
446
|
+
|
|
447
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
448
|
+
| --------------------------------------- | -------------------------- | ------- | ----------------------- | ------------------------------------------ |
|
|
449
|
+
| `waterfall-zoom-max-ratio` | `zoom.maxRatio` | number | `3` | Maximum zoom level. |
|
|
450
|
+
| `waterfall-zoom-min-ratio` | `zoom.minRatio` | number | `1` | Minimum zoom level. |
|
|
451
|
+
| `waterfall-zoom-toggle` | `zoom.toggle` | boolean | `true` | Double-tap toggles zoom. |
|
|
452
|
+
| `waterfall-zoom-limit-to-original-size` | `zoom.limitToOriginalSize` | boolean | `false` | Never zooms past the image's natural size. |
|
|
453
|
+
| `waterfall-zoom-pan-on-mouse-move` | `zoom.panOnMouseMove` | boolean | `false` | Pans the zoomed image by moving the mouse. |
|
|
454
|
+
| `waterfall-zoom-container-class` | `zoom.containerClass` | string | `swiper-zoom-container` | Class of the zoom container element. |
|
|
455
|
+
| `waterfall-zoomed-slide-class` | `zoom.zoomedSlideClass` | string | `swiper-slide-zoomed` | Class added to the zoomed slide. |
|
|
456
|
+
|
|
457
|
+
### Parallax
|
|
458
|
+
|
|
459
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
460
|
+
| ---------------------------- | ------------------ | ------- | ------- | ------------------------------------------------- |
|
|
461
|
+
| `waterfall-parallax-enabled` | `parallax.enabled` | boolean | `false` | Turns on parallax for elements inside the slider. |
|
|
462
|
+
|
|
463
|
+
With parallax on, add SwiperJS's native parallax attributes to elements **inside** the slides (or on a background element inside `.swiper`):
|
|
464
|
+
|
|
465
|
+
| Attribute | Values | Description |
|
|
466
|
+
| ------------------------------- | ----------------------------- | ---------------------------------------------------------------------------- |
|
|
467
|
+
| `data-swiper-parallax` | px or % (e.g. `-300`, `-50%`) | Horizontal offset for horizontal sliders, vertical offset for vertical ones. |
|
|
468
|
+
| `data-swiper-parallax-x` | px or % | Horizontal offset. |
|
|
469
|
+
| `data-swiper-parallax-y` | px or % | Vertical offset. |
|
|
470
|
+
| `data-swiper-parallax-scale` | number | Scale while the slide is out of view. |
|
|
471
|
+
| `data-swiper-parallax-opacity` | number (0–1) | Opacity while the slide is out of view. |
|
|
472
|
+
| `data-swiper-parallax-duration` | number (ms) | Custom transition duration for this element. |
|
|
473
|
+
|
|
474
|
+
### Lazy Loading
|
|
475
|
+
|
|
476
|
+
Add `loading="lazy"` to slide images (Webflow does this by default). Swiper can preload images in neighboring slides.
|
|
477
|
+
|
|
478
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
479
|
+
| ---------------------------------- | --------------------- | ------ | ----------------------- | -------------------------------------------------------------------------------- |
|
|
480
|
+
| `waterfall-lazy-preload-prev-next` | `lazyPreloadPrevNext` | number | `0` | Number of slides before and after the active slide whose lazy images load early. |
|
|
481
|
+
| `waterfall-lazy-preloader-class` | `lazyPreloaderClass` | string | `swiper-lazy-preloader` | Class of the preloader element that is removed once the image loads. |
|
|
482
|
+
|
|
483
|
+
### Accessibility (a11y)
|
|
484
|
+
|
|
485
|
+
Accessibility is **on by default**. Message attributes support the `{{index}}` and `{{slidesLength}}` placeholders.
|
|
486
|
+
|
|
487
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
488
|
+
| --------------------------------------------------- | -------------------------------------- | ------- | ------------------------------ | ---------------------------------------------------------------------- |
|
|
489
|
+
| `waterfall-a11y-enabled` | `a11y.enabled` | boolean | `true` | Turns accessibility features on or off. |
|
|
490
|
+
| `waterfall-a11y-prev-slide-message` | `a11y.prevSlideMessage` | string | `Previous slide` | Label for the previous button. |
|
|
491
|
+
| `waterfall-a11y-next-slide-message` | `a11y.nextSlideMessage` | string | `Next slide` | Label for the next button. |
|
|
492
|
+
| `waterfall-a11y-first-slide-message` | `a11y.firstSlideMessage` | string | `This is the first slide` | Announced on the first slide. |
|
|
493
|
+
| `waterfall-a11y-last-slide-message` | `a11y.lastSlideMessage` | string | `This is the last slide` | Announced on the last slide. |
|
|
494
|
+
| `waterfall-a11y-pagination-bullet-message` | `a11y.paginationBulletMessage` | string | `Go to slide {{index}}` | Label for each pagination bullet. |
|
|
495
|
+
| `waterfall-a11y-slide-label-message` | `a11y.slideLabelMessage` | string | `{{index}} / {{slidesLength}}` | `aria-label` for each slide. |
|
|
496
|
+
| `waterfall-a11y-container-message` | `a11y.containerMessage` | string | — | `aria-label` for the slider container. |
|
|
497
|
+
| `waterfall-a11y-container-role` | `a11y.containerRole` | string | — | `role` for the slider container. |
|
|
498
|
+
| `waterfall-a11y-container-role-description-message` | `a11y.containerRoleDescriptionMessage` | string | — | `aria-roledescription` for the container (e.g. `carousel`). |
|
|
499
|
+
| `waterfall-a11y-item-role-description-message` | `a11y.itemRoleDescriptionMessage` | string | — | `aria-roledescription` for each slide (e.g. `slide`). |
|
|
500
|
+
| `waterfall-a11y-slide-role` | `a11y.slideRole` | string | `group` | `role` for each slide. |
|
|
501
|
+
| `waterfall-a11y-id` | `a11y.id` | string | _(random)_ | ID for the wrapper, used by `aria-controls` on the navigation buttons. |
|
|
502
|
+
| `waterfall-a11y-notification-class` | `a11y.notificationClass` | string | `swiper-notification` | Class of the live-region element used for announcements. |
|
|
503
|
+
| `waterfall-a11y-scroll-on-focus` | `a11y.scrollOnFocus` | boolean | `true` | Scrolls to a slide when it receives keyboard focus. |
|
|
504
|
+
|
|
505
|
+
### Observer
|
|
506
|
+
|
|
507
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
508
|
+
| ----------------------------------- | ---------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------- |
|
|
509
|
+
| `waterfall-observer` | `observer` | boolean | `false` | Re-initializes the slider when its style or slides change. Useful for sliders inside tabs or modals. |
|
|
510
|
+
| `waterfall-observe-parents` | `observeParents` | boolean | `false` | Also watches parent elements for changes. |
|
|
511
|
+
| `waterfall-observe-slide-children` | `observeSlideChildren` | boolean | `false` | Also watches for changes inside slides. |
|
|
512
|
+
| `waterfall-resize-observer` | `resizeObserver` | boolean | `true` | Uses ResizeObserver to detect container size changes. |
|
|
513
|
+
| `waterfall-update-on-window-resize` | `updateOnWindowResize` | boolean | `true` | Recalculates the layout when the window is resized. |
|
|
514
|
+
| `waterfall-watch-overflow` | `watchOverflow` | boolean | `true` | Disables the slider and hides navigation when there aren't enough slides to scroll. |
|
|
515
|
+
| `waterfall-watch-slides-progress` | `watchSlidesProgress` | boolean | `false` | Tracks each slide's progress and adds visibility classes. Required on thumbnail sliders. |
|
|
516
|
+
|
|
517
|
+
### CSS Classes
|
|
518
|
+
|
|
519
|
+
Override the classes Swiper uses. Leave these at their defaults unless your markup uses different class names.
|
|
520
|
+
|
|
521
|
+
| Attribute | Swiper option | Default |
|
|
522
|
+
| ------------------------------------- | ------------------------ | ---------------------------- |
|
|
523
|
+
| `waterfall-container-modifier-class` | `containerModifierClass` | `swiper-` |
|
|
524
|
+
| `waterfall-wrapper-class` | `wrapperClass` | `swiper-wrapper` |
|
|
525
|
+
| `waterfall-slide-class` | `slideClass` | `swiper-slide` |
|
|
526
|
+
| `waterfall-slide-active-class` | `slideActiveClass` | `swiper-slide-active` |
|
|
527
|
+
| `waterfall-slide-next-class` | `slideNextClass` | `swiper-slide-next` |
|
|
528
|
+
| `waterfall-slide-prev-class` | `slidePrevClass` | `swiper-slide-prev` |
|
|
529
|
+
| `waterfall-slide-visible-class` | `slideVisibleClass` | `swiper-slide-visible` |
|
|
530
|
+
| `waterfall-slide-fully-visible-class` | `slideFullyVisibleClass` | `swiper-slide-fully-visible` |
|
|
531
|
+
| `waterfall-slide-blank-class` | `slideBlankClass` | `swiper-slide-blank` |
|
|
532
|
+
|
|
533
|
+
### Advanced
|
|
534
|
+
|
|
535
|
+
Rarely needed. Some of these can break other features, so change them only if you know you need to.
|
|
536
|
+
|
|
537
|
+
| Attribute | Swiper option | Values | Default | Description |
|
|
538
|
+
| -------------------------------------- | ------------------------- | ------- | ------------------ | ------------------------------------------------------------------------------------------------------- |
|
|
539
|
+
| `waterfall-enabled` | `enabled` | boolean | `true` | Set to `false` to create the slider in a disabled state. |
|
|
540
|
+
| `waterfall-init` | `init` | boolean | `true` | Set to `false` to skip automatic initialization; call `swiper.init()` yourself. |
|
|
541
|
+
| `waterfall-css-mode` | `cssMode` | boolean | `false` | Uses native CSS scroll-snap. Many features (effects, loop, some touch options) don't work in CSS mode. |
|
|
542
|
+
| `waterfall-round-lengths` | `roundLengths` | boolean | `false` | Rounds slide widths and heights to whole pixels to avoid blurry text. |
|
|
543
|
+
| `waterfall-max-backface-hidden-slides` | `maxBackfaceHiddenSlides` | number | `10` | Above this slide count, `backface-visibility: hidden` is not applied (a Safari performance workaround). |
|
|
544
|
+
| `waterfall-passive-listeners` | `passiveListeners` | boolean | `true` | Uses passive event listeners where possible. |
|
|
545
|
+
| `waterfall-run-callbacks-on-init` | `runCallbacksOnInit` | boolean | `true` | Fires transition callbacks on initialization. |
|
|
546
|
+
| `waterfall-unique-nav-elements` | `uniqueNavElements` | boolean | `true` | Looks for navigation elements only inside the slider. |
|
|
547
|
+
| `waterfall-set-wrapper-size` | `setWrapperSize` | boolean | `false` | Sets the wrapper's width/height explicitly (for old browsers without flexbox). |
|
|
548
|
+
| `waterfall-create-elements` | `createElements` | boolean | `false` | Auto-creates navigation/pagination/scrollbar elements. Prefer building them in Webflow instead. |
|
|
549
|
+
| `waterfall-events-prefix` | `eventsPrefix` | string | `swiper` | Prefix for DOM events emitted by the slider. |
|
|
550
|
+
| `waterfall-swiper-element-node-name` | `swiperElementNodeName` | string | `SWIPER-CONTAINER` | Node name used to detect Swiper Element (web component) containers. |
|
|
551
|
+
| `waterfall-url` | `url` | string | — | Page URL for server-side rendering with history navigation. |
|
|
552
|
+
| `waterfall-user-agent` | `userAgent` | string | — | User agent for server-side rendering. |
|
|
553
|
+
|
|
554
|
+
### Callbacks
|
|
555
|
+
|
|
556
|
+
| Attribute | Values | Description |
|
|
557
|
+
| --------------------------------- | -------------------- | --------------------------------------------------------- |
|
|
558
|
+
| `waterfall-callback-slide-change` | Global function name | Calls `window[name]` every time the active slide changes. |
|
|
559
|
+
|
|
560
|
+
The function receives a single object:
|
|
561
|
+
|
|
562
|
+
```html
|
|
563
|
+
<div waterfall="hero" waterfall-callback-slide-change="onHeroChange">…</div>
|
|
564
|
+
|
|
565
|
+
<script>
|
|
566
|
+
window.onHeroChange = ({ swiper, activeIndex, previousIndex, activeSlide, previousSlide }) => {
|
|
567
|
+
console.log(`Moved from slide ${previousIndex} to ${activeIndex}`, activeSlide);
|
|
568
|
+
};
|
|
569
|
+
</script>
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
TypeScript users can import the parameter type: `import type { SlideChangeCallbackParams } from "well-waterfall";`
|
|
99
573
|
|
|
100
|
-
|
|
574
|
+
### Slide Manipulation
|
|
101
575
|
|
|
102
|
-
|
|
576
|
+
Moves elements from elsewhere on the page into a Waterfall when the page loads, for example to inject a CTA card or content from a second CMS list. Put the attribute on the element to insert; its value is the target Waterfall's name. The element is cloned into the slider (with the `swiper-slide` class added if missing) and the original is removed. If the original was inside a Webflow Collection List (`.w-dyn-list`), that list is removed too.
|
|
103
577
|
|
|
104
|
-
|
|
578
|
+
| Attribute | Values | Description |
|
|
579
|
+
| ------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
580
|
+
| `waterfall-append-slide` | Waterfall name | Adds this element as the last slide. |
|
|
581
|
+
| `waterfall-prepend-slide` | Waterfall name | Adds this element as the first slide. |
|
|
582
|
+
| `waterfall-add-slide` | Waterfall name | Inserts this element at the position given by `waterfall-add-index`. |
|
|
583
|
+
| `waterfall-add-index` | number | Position for `waterfall-add-slide` (defaults to `1`). |
|
|
584
|
+
| `waterfall-remove-slide` | Waterfall name | Removes the slide at `waterfall-remove-index` from the target slider. This element itself is also removed. |
|
|
585
|
+
| `waterfall-remove-index` | number | Index of the slide to remove. |
|
|
105
586
|
|
|
106
|
-
|
|
587
|
+
```html
|
|
588
|
+
<div waterfall-append-slide="SWIPER_NAME" class="cta-card">Contact us</div>
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
## Element Reference
|
|
592
|
+
|
|
593
|
+
Elements are identified with the `waterfall-el` attribute and must be placed **inside** the `[waterfall]` wrapper, so each slider finds its own controls.
|
|
594
|
+
|
|
595
|
+
| `waterfall-el` value | Purpose |
|
|
596
|
+
| ------------------------ | ----------------------------------------------------------------------------------------- |
|
|
597
|
+
| `navigation-next` | Next slide button. Enables navigation. |
|
|
598
|
+
| `navigation-prev` | Previous slide button. Enables navigation. |
|
|
599
|
+
| `pagination` | Pagination container. Enables pagination. |
|
|
600
|
+
| `pagination-bullet` | Optional bullet template. Its tag name and classes are applied to every generated bullet. |
|
|
601
|
+
| `scrollbar` | Scrollbar track. Enables the scrollbar. |
|
|
602
|
+
| `scrollbar-drag` | Scrollbar handle, placed inside `scrollbar`. Its classes are applied to the drag handle. |
|
|
603
|
+
| `slide-count` | Placed inside a slide; its text is replaced with that slide's 1-based number. |
|
|
604
|
+
| `autoplay-control` | Play/pause button. See [Autoplay Control Button](#autoplay-control-button). |
|
|
605
|
+
| `autoplay-control-play` | Icon shown while autoplay is paused. |
|
|
606
|
+
| `autoplay-control-pause` | Icon shown while autoplay is playing. |
|
|
607
|
+
|
|
608
|
+
## JavaScript API
|
|
609
|
+
|
|
610
|
+
Every initialized Waterfall is added to `window.waterfalls`, giving you full access to the underlying [Swiper instance](https://swiperjs.com/swiper-api#methods-and-properties):
|
|
611
|
+
|
|
612
|
+
```js
|
|
613
|
+
// window.waterfalls: Array<{ name: string; swiper: Swiper }>
|
|
614
|
+
const hero = window.waterfalls.find((w) => w.name === "hero");
|
|
615
|
+
hero.swiper.slideNext();
|
|
616
|
+
hero.swiper.on("reachEnd", () => console.log("Reached the end"));
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
When installed from npm, the package also exports all attribute and element name constants (e.g. `ATTR_SLIDES_PER_VIEW`, `EL_PAGINATION`).
|
|
620
|
+
|
|
621
|
+
## Not Supported
|
|
622
|
+
|
|
623
|
+
- Creative Effect
|
|
624
|
+
- Virtual Slides
|
|
625
|
+
- Arbitrary Swiper event handlers via attributes (use `waterfall-callback-slide-change` or the [JavaScript API](#javascript-api))
|
|
626
|
+
- `slidesPerView: auto` at responsive breakpoints
|
|
627
|
+
|
|
628
|
+
## Development
|
|
629
|
+
|
|
630
|
+
```bash
|
|
631
|
+
npm install
|
|
632
|
+
npm run build
|
|
633
|
+
```
|
|
107
634
|
|
|
108
635
|
## Built With
|
|
109
636
|
|
|
110
|
-
- [SwiperJS 11.2.10](https://github.com/nolimits4web/swiper
|
|
111
|
-
-
|
|
112
|
-
-
|
|
637
|
+
- [SwiperJS <!-- swiper-version -->11.2.10<!-- /swiper-version -->](https://github.com/nolimits4web/swiper)
|
|
638
|
+
- TypeScript
|
|
639
|
+
- Vite
|
|
113
640
|
|
|
114
641
|
## Authors
|
|
115
642
|
|
|
@@ -117,4 +644,4 @@ A full list of attributes can be found at `src/lib/attributes.ts`. Swiper Elemen
|
|
|
117
644
|
|
|
118
645
|
## License
|
|
119
646
|
|
|
120
|
-
|
|
647
|
+
ISC © Kevin Gerstner
|