sticky-scroll-trigger 0.16.0 → 0.17.0
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
CHANGED
|
@@ -40,7 +40,7 @@ npm install gsap sticky-scroll-trigger
|
|
|
40
40
|
For plain `<script>` usage without a bundler, an IIFE build is also published, exposing `window.StickyScrollTrigger`:
|
|
41
41
|
|
|
42
42
|
```html
|
|
43
|
-
<script src="https://cdn.jsdelivr.net/npm/sticky-scroll-trigger@0.
|
|
43
|
+
<script src="https://cdn.jsdelivr.net/npm/sticky-scroll-trigger@0.17.0/dist/StickyScrollTrigger.global.min.js"></script>
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Consumers should only rely on the exports of `sticky-scroll-trigger` (or `window.StickyScrollTrigger` for the global build). The internal modules under `src/` are not part of the public API.
|
|
@@ -183,13 +183,13 @@ Inside GSAP's own refresh, a layer's `onRefreshInit` runs `refresh()` again only
|
|
|
183
183
|
|
|
184
184
|
Registers an overlap-scroll effect (`trigger` gets pinned while its siblings from `cover` onward scroll normally and rise up to cover it) and returns `ScrollTrigger.Vars`. No tween or dwell spacer is created. Since the return value only describes the freeze window, the effect works even without passing it to `ScrollTrigger.create()`, unless you need `markers` or callbacks.
|
|
185
185
|
|
|
186
|
-
| option | default
|
|
187
|
-
| ------------ |
|
|
188
|
-
| `trigger` | (required)
|
|
189
|
-
| `cover` | `trigger
|
|
190
|
-
| `start` | `'bottom bottom'`
|
|
191
|
-
| `end` | `null` (auto-computed)
|
|
192
|
-
| `endTrigger` | `trigger`
|
|
186
|
+
| option | default | description |
|
|
187
|
+
| ------------ | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
188
|
+
| `trigger` | (required) | The element that gets pinned and covered. Must be inside the shared container; throws otherwise. Its own parent, which doesn't have to be the container itself, bounds how far the rise can run (see below) |
|
|
189
|
+
| `cover` | `trigger`'s next sibling | The first element of the covering side; this and all following siblings cover together. Must share the same parent as `trigger` (see [Constraints and caveats](#constraints-and-caveats)) |
|
|
190
|
+
| `start` | `'bottom bottom'` | Pinned position of `trigger`. See [position syntax](#position-syntax). Unlike `createStickyTrigger`'s `start`, this doesn't support an absolute scroll position (a bare number): it throws instead |
|
|
191
|
+
| `end` | `null` (auto-computed) | End of the freeze window. When `null`, computed automatically as "the distance until `cover`'s top edge reaches the top of the viewport" |
|
|
192
|
+
| `endTrigger` | `trigger` | Reference element when `end` uses position-clause syntax |
|
|
193
193
|
|
|
194
194
|
`start` and `end` are the two defaults this module doesn't take from GSAP, which pins at `'top top'` and ends at `'bottom top'`. The rise needs `cover` to begin off screen: pinned at the viewport's top, a `trigger` shorter than the viewport leaves the covering side already showing underneath it. `'bottom bottom'` rests `trigger` against the viewport's bottom edge instead, and the auto `end` measures the rise from there.
|
|
195
195
|
|
|
@@ -293,11 +293,11 @@ Clauses resolve exactly as they do elsewhere, including the one-token forms that
|
|
|
293
293
|
|
|
294
294
|
`endTrigger` and `end` both default to GSAP's own values. `'bottom top'` releases the pin once `endTrigger`'s bottom edge reaches the viewport's top edge, so naming an `endTrigger` and leaving `end` alone holds the pin for that element's own height past its top. Omit both and `trigger` pins against itself, held for its own height, the duration GSAP's `pin: true` gives.
|
|
295
295
|
|
|
296
|
-
`trigger` keeps its own space in the page: every [`refresh()`](#refresh) sizes its wrapper to `trigger`'s margin box, so registering a pin doesn't shorten the document or move what follows. The wrapping does change margin collapsing, though. `trigger`'s vertical margins stop at that wrapper instead of collapsing with its siblings', and no sizing can give that back, since the collapsing partner sits outside it. A `margin-bottom: 30px` above a `trigger` with `margin-top: 20px` occupies 30px unpinned and 50px pinned.
|
|
296
|
+
`trigger` keeps its own space in the page: every [`refresh()`](#refresh) sizes its wrapper to `trigger`'s margin box, so registering a pin doesn't shorten the document or move what follows. Where `trigger`'s height would resolve against the wrapper instead (a percentage `height`, `min-height` or `max-height`), every `refresh()` also reads it with the wrappers out of the layout and writes it on `trigger` in px (`min-height` and `max-height` too, at that height, all `!important` so a stylesheet's `!important` doesn't win over them), as GSAP holds a pin's height: the percentage resolves against `trigger`'s own container, and, like an item's box below, stays as last read until the next `refresh()`. A height set by the content, in px or in viewport units isn't written, so it goes on following them between refreshes. A pin inside another pin's `trigger` keeps the percentage height it had before either was pinned, so under an outer `trigger` with an auto height it stays auto, where GSAP's resolves against the height GSAP holds on the outer pin. The wrapping does change margin collapsing, though. `trigger`'s vertical margins stop at that wrapper instead of collapsing with its siblings', and no sizing can give that back, since the collapsing partner sits outside it. A `margin-bottom: 30px` above a `trigger` with `margin-top: 20px` occupies 30px unpinned and 50px pinned.
|
|
297
297
|
|
|
298
|
-
In a flex or grid container, floated, or inline-level (`inline-block`, say), the wrapper takes over `trigger`'s place, and `trigger` keeps its own box inside it, as with GSAP's pin-spacer: every `refresh()` reads the box the container gives `trigger`, holds it on the wrapper in px (a grid item's width is left to the grid), and writes `trigger`'s width, height, padding and margins in px, as GSAP writes a pin's (`max-width`
|
|
298
|
+
In a flex or grid container, floated, or inline-level (`inline-block`, say), the wrapper takes over `trigger`'s place, and `trigger` keeps its own box inside it, as with GSAP's pin-spacer: every `refresh()` reads the box the container gives `trigger`, holds it on the wrapper in px (a grid item's width is left to the grid), and writes `trigger`'s width, height, padding and margins in px, as GSAP writes a pin's (`max-width` at the width, `max-height` and `min-height` at the height), `!important` as above. A `clear` on `trigger` applies to the wrapper too, wherever it applied to `trigger`.
|
|
299
299
|
|
|
300
|
-
Those values stay as last read until the next `refresh()`, which a window resize runs on its own; a container resized any other way, or content or a class that changes `trigger`'s size, needs one, and so does a `trigger` that had no box when it last ran (inside a hidden tab, say), which until then sits by its own flex or grid properties alone. Each `refresh()` puts `trigger`'s own inline values for those properties back before it reads, and a kill or `destroy()` puts them back for good; a value set on one of them since the last `refresh()` (with `gsap.set`, say) is kept instead. A CSS `transition` on any of them plays on `trigger` each time a `refresh()` changes them, through sizes that are neither the old one nor the new.
|
|
300
|
+
Those values stay as last read until the next `refresh()`, which a window resize runs on its own; a container resized any other way, or content or a class that changes `trigger`'s size, needs one, and so does a `trigger` that had no box when it last ran (inside a hidden tab, say), which until then sits by its own flex or grid properties alone. Each `refresh()` puts `trigger`'s own inline values for those properties back before it reads, and a kill or `destroy()` puts them back for good; a value set on one of them since the last `refresh()` (with `gsap.set`, say) is kept instead. A CSS `transition` on any of them plays on `trigger` each time a `refresh()` changes them, through sizes that are neither the old one nor the new. A CSS `@keyframes` animation of them, on the other hand, stops while `trigger` is pinned, since an `!important` inline value outranks it.
|
|
301
301
|
|
|
302
302
|
Two differences remain, since `trigger` is now a box inside the wrapper rather than the container's item. Its content's vertical margins can collapse through its top or bottom edge where it has no padding or border there, shifting `trigger`'s own box, background included, by that margin while the content stays put. And an `inline-block` `trigger` with `vertical-align: middle`, `text-top` or `bottom` sits lower, aligned in a line of the wrapper's own instead of the one around it; `baseline` and `top` line up as before, and what follows doesn't move. To avoid these, pin an element inside the item instead:
|
|
303
303
|
|
|
@@ -414,7 +414,7 @@ Recomputes each layer's sticky `top`, dwell spacer height, and freeze window (`s
|
|
|
414
414
|
|
|
415
415
|
It measures at scroll 0, as GSAP's own refresh does, so a sticky element around what it measures, whether the page's own or another instance's, sits where GSAP sees it. Away from the top, a call of your own scrolls there and back before it returns, as `ScrollTrigger.refresh()` does. Nothing is painted in between, though a `scroll` event fires. While the page scrolls, it does so only with such a sticky element around what it measures, since the trip stops the scroll; without one it measures where the page is, with the same result. Inside GSAP's refresh it scrolls there and back too, ahead of GSAP's own trip.
|
|
416
416
|
|
|
417
|
-
Kill-driven updates are deferred to a microtask, or to a GSAP refresh later in the same task, and coalesced per task. While the page scrolls, they wait for the scroll to stop, as GSAP's own refresh does. Killing `createStickyTrigger` layers while another layer or pin is left leaves their nesting levels in the DOM, no longer sticky and with no dwell, so nothing inside the managed container moves for them; they come off at the next rebuild. Adding or reordering triggers rebuilds the nesting, and killing the last layer or pin takes it down
|
|
417
|
+
Kill-driven updates are deferred to a microtask, or to a GSAP refresh later in the same task, and coalesced per task. While the page scrolls, they wait for the scroll to stop, as GSAP's own refresh does. Killing `createStickyTrigger` layers while another layer or pin is left leaves their nesting levels in the DOM, no longer sticky and with no dwell, so nothing inside the managed container moves for them; they come off at the next rebuild. Adding or reordering triggers rebuilds the nesting, and killing the last layer or pin takes it down. In Chrome and Edge 133+ and Firefox 144+ that DOM move uses `moveBefore()`, which keeps `<iframe>` elements inside the managed container loaded and focused inputs focused (Chrome still restarts a running CSS animation, and Firefox resets the scroll position of an element scrolled inside). Safari has no `moveBefore()`, so there the move reloads iframes and drops focus. This cannot be disabled, so be careful when placing iframes or focus-sensitive inputs under the controller for Safari.
|
|
418
418
|
|
|
419
419
|
A killed `createOverlapScroll` layer's wrapper, which holds `trigger` and every sibling before it, comes off during the kill instead, so the iframe and focus effects there happen then. Code later in the same task (the next breakpoint's `gsap.matchMedia()` setup, say) finds `trigger` back among those siblings, unless another overlap in the same parent still wraps it. Scene layers' updates still wait for the microtask or a GSAP refresh in the same task, unless the kill leaves the instance with no layer or pin: then everything it put on the page comes off during the kill, or once the scroll stops if the page is scrolling (see [`destroy()`](#destroy)).
|
|
420
420
|
|
|
@@ -616,7 +616,7 @@ sticky.createOverlapScroll({
|
|
|
616
616
|
- The structure directly under the shared container changes because of the added wrapper elements. Direct-child selectors like `.container__inner > .scene`, `:nth-child()`, adjacent-sibling selectors (`+`/`~`), and flex/grid layout on the shared container itself may break across the wrapper boundary
|
|
617
617
|
- The same goes for selector strings, including those you pass to this module (`trigger`, `endTrigger`, `cover`, `element`, `scrollMarginTargets`). After `refresh()`, Scene layers wrap the shared container itself, `createOverlapScroll` wraps `trigger` and the siblings before it, and `createStickyPin` wraps `trigger`. A selector that steps from parent to child or between siblings across a wrapper then stops matching (`main > .container__inner`, `.container__inner > p:first-child`, `scrollMarginTargets: ':scope > section'`), and `'div'` or `'*'` matches the wrappers too. Class and id selectors, the default `'[id]'` included, match as before
|
|
618
618
|
- `position:sticky` doesn't work if any ancestor of the pinned target has `overflow` set to `hidden`, `auto` or `scroll` on either axis. `clip` keeps it working. So does any value on `html`, and on `body` while `html`'s is `visible`, since the browser then applies it to the viewport
|
|
619
|
-
- `createOverlapScroll`'s `trigger` and `cover` must be siblings sharing the same parent
|
|
619
|
+
- `createOverlapScroll`'s `trigger` and `cover` must be siblings sharing the same parent. They're read in the page's own markup, through the wrappers of pins, Scene layers and the instance's own overlaps (not another instance's overlaps), so an overlap gets the same `cover` and wrapper whether it registers before or after those are built
|
|
620
620
|
- That shared parent also caps how far `cover` can rise: it needs `end - start` worth of content below `trigger`, or the browser releases the wrapper mid-rise, at a point that shifts with the window size (see [Room for the rise](#room-for-the-rise))
|
|
621
621
|
- Everything in that parent up to and including `trigger` is pinned with `trigger` until the rise runs out of room, and [`resolveScrollPosition`](#resolvescrollpositionelement-position), [`getScrollTop`](#stickyscrolltriggergetscrolltopelement-instances) and same-page links don't account for that pin. A position such an element reaches before the pin starts resolves correctly. A later one is only reached after `cover` has risen over the element, so it has no uncovered scroll position: a same-page link lands while the element is pinned, below the viewport's top edge and possibly already under `cover`
|
|
622
622
|
- `createStickyTrigger` and `createOverlapScroll` throw if `trigger` isn't inside the shared container. Both build their structure inside it, so a `trigger` elsewhere would wrap, move and style elements the instance doesn't own
|
|
@@ -634,7 +634,7 @@ sticky.createOverlapScroll({
|
|
|
634
634
|
- Using the same element as the `trigger` of two different `createStickyTrigger`/`createOverlapScroll`/`createStickyPin` calls on one instance throws. Nothing checks this across instances, so give each element to one instance: `createStickyPin` on one element from two instances nests one instance's wrapper inside the other's, and once the outer one's pin (the one whose `refresh()` wrapped the element first) is killed, the inner one's range is wrong
|
|
635
635
|
- You must call `refresh()` once manually after registration. Window resize/load recomputation is automatically wired to GSAP's own `refreshInit`, but for layout changes that don't involve those (e.g. content height changes), call `ScrollTrigger.refresh()` yourself (see [Calling refresh](#calling-refresh))
|
|
636
636
|
- Resizes from mobile browsers showing/hiding their address bar are absorbed automatically (see the repository's `ARCHITECTURE.md`, "Two-pass position measurement"), but other causes like `visualViewport` zoom are not handled
|
|
637
|
-
- `refresh()` writes an inline `scroll-margin-top` on every element matching `scrollMarginTargets` inside the shared container, and, on engines that drive the correction's ramps in CSS, adopts one stylesheet of its own per instance. That sheet is a constructed one, so a Content Security Policy needs no `style-src` exception for it. Both are undone by `destroy()`, and when the instance's last layer or pin is killed. Pass `scrollMarginTargets: null` to opt out (see [Same-page links](#same-page-links))
|
|
637
|
+
- `refresh()` writes an inline `scroll-margin-top: ... !important` on every element matching `scrollMarginTargets` inside the shared container, and, on engines that drive the correction's ramps in CSS, adopts one stylesheet of its own per instance. That sheet is a constructed one, so a Content Security Policy needs no `style-src` exception for it. Both are undone by `destroy()`, and when the instance's last layer or pin is killed. Pass `scrollMarginTargets: null` to opt out (see [Same-page links](#same-page-links))
|
|
638
638
|
- A ScrollTrigger of your own that pins with GSAP (its `pin` option) outside the shared container leaves what this module measured stale when the pin's spacing changes in a GSAP refresh (a resize with an `end` in `%` of the viewport, say), because GSAP sizes its pins after the `refreshInit` in which this module measures: below the pin, a layer's window opens early or late by the change, and what reads the document's height, such as a cover's `'max'` end, misses the new height. One more `ScrollTrigger.refresh()` puts it right. To avoid the gap, pin that section with `createStickyTrigger` instead, as a layer of the instance it leaves stale, inside that instance's shared container. `createStickyPin` can't replace it, since, unlike GSAP's pin spacing, it adds no scroll distance
|
|
639
639
|
- A `resolveScrollPosition` or `getScrollTop` call made while the page scrolls (while `ScrollTrigger.isScrolling()` says so, which lasts a moment past the scroll's end, or from a ScrollTrigger callback the scroll runs) measures an element inside another instance's pin, or inside a `position: sticky` element of the page's own, where it sits at that moment, since going to scroll 0 would stop the scroll. When that element is stuck, the result comes out late by however far it is stuck. Call it at rest, or from a function-valued `start`/`end`, which runs inside a refresh
|
|
640
640
|
- Don't nest one `StickyScrollTrigger` instance's shared container inside another's. The inner instance's layers don't count the outer one's dwell, so their windows open too early by however much of that dwell comes before them. For a target inside both, [`getScrollTop`](#stickyscrolltriggergetscrolltopelement-instances)'s ownership check also picks whichever instance is listed first, and a same-page link to such a target lands by one instance's correction only. Give each instance its own part of the page instead
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @license
|
|
3
|
-
* StickyScrollTrigger v0.
|
|
3
|
+
* StickyScrollTrigger v0.17.0
|
|
4
4
|
* Copyright (c) 2026 Kuninori Ogino
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
* https://github.com/kuninori-ogino/sticky-scroll-trigger
|
|
@@ -88,8 +88,9 @@ var StickyScrollTrigger = (function() {
|
|
|
88
88
|
return 0;
|
|
89
89
|
};
|
|
90
90
|
const resetStickyPosition = (el) => {
|
|
91
|
-
el.style.position
|
|
92
|
-
el.style.top
|
|
91
|
+
el.style.setProperty("position", "relative", "important");
|
|
92
|
+
el.style.setProperty("top", "auto", "important");
|
|
93
|
+
el.style.setProperty("bottom", "auto", "important");
|
|
93
94
|
};
|
|
94
95
|
const captureInline = (el, property) => ({
|
|
95
96
|
value: el.style.getPropertyValue(property),
|
|
@@ -100,19 +101,21 @@ var StickyScrollTrigger = (function() {
|
|
|
100
101
|
};
|
|
101
102
|
const captureInlinePosition = (el) => ({
|
|
102
103
|
position: captureInline(el, "position"),
|
|
103
|
-
top: captureInline(el, "top")
|
|
104
|
+
top: captureInline(el, "top"),
|
|
105
|
+
bottom: captureInline(el, "bottom")
|
|
104
106
|
});
|
|
105
107
|
const restoreInlinePosition = (el, saved) => {
|
|
106
108
|
restoreInline(el, "position", saved.position);
|
|
107
109
|
restoreInline(el, "top", saved.top);
|
|
110
|
+
restoreIfWritten(el, "bottom", saved.bottom, "auto", "important");
|
|
108
111
|
};
|
|
109
|
-
const writeInline = (el, property, value) => {
|
|
110
|
-
el.style.setProperty(property, value);
|
|
112
|
+
const writeInline = (el, property, value, priority = "") => {
|
|
113
|
+
el.style.setProperty(property, value, priority);
|
|
111
114
|
return el.style.getPropertyValue(property);
|
|
112
115
|
};
|
|
113
|
-
const restoreIfWritten = (el, property, saved, written) => {
|
|
116
|
+
const restoreIfWritten = (el, property, saved, written, priority = "") => {
|
|
114
117
|
const { style } = el;
|
|
115
|
-
if (style.getPropertyValue(property) !== written || style.getPropertyPriority(property)) return false;
|
|
118
|
+
if (style.getPropertyValue(property) !== written || style.getPropertyPriority(property) !== priority) return false;
|
|
116
119
|
restoreInline(el, property, saved);
|
|
117
120
|
return true;
|
|
118
121
|
};
|
|
@@ -142,20 +145,72 @@ var StickyScrollTrigger = (function() {
|
|
|
142
145
|
el.style.setProperty("transition", "none", "important");
|
|
143
146
|
return el;
|
|
144
147
|
};
|
|
148
|
+
let movesUnderWay = 0;
|
|
149
|
+
const isMovingDom = () => movesUnderWay > 0;
|
|
150
|
+
const moveInto = (parent, node, before = null) => {
|
|
151
|
+
const target = parent;
|
|
152
|
+
movesUnderWay += 1;
|
|
153
|
+
try {
|
|
154
|
+
if (target.moveBefore && parent.isConnected && node.isConnected) try {
|
|
155
|
+
target.moveBefore(node, before);
|
|
156
|
+
return;
|
|
157
|
+
} catch {}
|
|
158
|
+
parent.insertBefore(node, before);
|
|
159
|
+
} finally {
|
|
160
|
+
movesUnderWay -= 1;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const transparentNodes = new WeakSet();
|
|
164
|
+
const isTransparent = (el, own) => transparentNodes.has(el) || own.has(el);
|
|
165
|
+
const logicalParent = (el, own) => {
|
|
166
|
+
let parent = el.parentElement;
|
|
167
|
+
while (parent && isTransparent(parent, own)) parent = parent.parentElement;
|
|
168
|
+
return parent;
|
|
169
|
+
};
|
|
170
|
+
const firstLogicalAt = (el, own) => {
|
|
171
|
+
if (!isTransparent(el, own)) return el;
|
|
172
|
+
for (const child of Array.from(el.children)) {
|
|
173
|
+
const found = firstLogicalAt(child, own);
|
|
174
|
+
if (found) return found;
|
|
175
|
+
}
|
|
176
|
+
return null;
|
|
177
|
+
};
|
|
178
|
+
const logicalNextSibling = (el, own) => {
|
|
179
|
+
for (let node = el;;) {
|
|
180
|
+
for (let sibling = node.nextElementSibling; sibling; sibling = sibling.nextElementSibling) {
|
|
181
|
+
const found = firstLogicalAt(sibling, own);
|
|
182
|
+
if (found) return found;
|
|
183
|
+
}
|
|
184
|
+
const parent = node.parentElement;
|
|
185
|
+
if (!parent || !isTransparent(parent, own)) return null;
|
|
186
|
+
node = parent;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const physicalHolder = (el) => {
|
|
190
|
+
let node = el;
|
|
191
|
+
while (node.parentElement && transparentNodes.has(node.parentElement)) node = node.parentElement;
|
|
192
|
+
return node;
|
|
193
|
+
};
|
|
145
194
|
const wrapScene = (inner, holdTrailingMargin) => {
|
|
146
195
|
if (!inner.parentNode) throw new Error(`StickyScrollTrigger: ${describeElement(inner)} is not attached to the document`);
|
|
147
196
|
const container = createStructureElement();
|
|
148
197
|
const wrapper = createStructureElement();
|
|
149
198
|
const padding = createStructureElement();
|
|
199
|
+
[
|
|
200
|
+
container,
|
|
201
|
+
wrapper,
|
|
202
|
+
padding
|
|
203
|
+
].forEach((node) => transparentNodes.add(node));
|
|
150
204
|
padding.setAttribute("aria-hidden", "true");
|
|
151
205
|
padding.style.pointerEvents = "none";
|
|
152
206
|
inner.parentNode.insertBefore(container, inner);
|
|
153
207
|
container.appendChild(wrapper);
|
|
154
|
-
wrapper
|
|
208
|
+
moveInto(wrapper, inner);
|
|
155
209
|
container.appendChild(padding);
|
|
156
210
|
if (holdTrailingMargin) {
|
|
157
211
|
const sentinel = createStructureElement();
|
|
158
212
|
sentinel.style.display = "flow-root";
|
|
213
|
+
transparentNodes.add(sentinel);
|
|
159
214
|
wrapper.appendChild(sentinel);
|
|
160
215
|
}
|
|
161
216
|
return {
|
|
@@ -165,21 +220,22 @@ var StickyScrollTrigger = (function() {
|
|
|
165
220
|
};
|
|
166
221
|
};
|
|
167
222
|
const wrapCover = (trigger) => {
|
|
168
|
-
const
|
|
223
|
+
const holder = physicalHolder(trigger);
|
|
224
|
+
const parent = holder.parentNode;
|
|
169
225
|
if (!parent) throw new Error(`createOverlapScroll: trigger ${describeElement(trigger)} is not attached to the document`);
|
|
170
226
|
const wrapper = createStructureElement();
|
|
171
227
|
parent.insertBefore(wrapper, parent.firstChild);
|
|
172
228
|
while (wrapper.nextSibling) {
|
|
173
229
|
const node = wrapper.nextSibling;
|
|
174
|
-
wrapper
|
|
175
|
-
if (node ===
|
|
230
|
+
moveInto(wrapper, node);
|
|
231
|
+
if (node === holder) break;
|
|
176
232
|
}
|
|
177
233
|
return wrapper;
|
|
178
234
|
};
|
|
179
235
|
const unwrapCover = (wrapper) => {
|
|
180
236
|
const parent = wrapper.parentNode;
|
|
181
237
|
if (!parent) return;
|
|
182
|
-
while (wrapper.firstChild) parent
|
|
238
|
+
while (wrapper.firstChild) moveInto(parent, wrapper.firstChild, wrapper);
|
|
183
239
|
wrapper.remove();
|
|
184
240
|
};
|
|
185
241
|
const wrapPin = (trigger) => {
|
|
@@ -187,9 +243,11 @@ var StickyScrollTrigger = (function() {
|
|
|
187
243
|
const outer = createStructureElement();
|
|
188
244
|
const inner = createStructureElement();
|
|
189
245
|
outer.style.display = "flow-root";
|
|
246
|
+
transparentNodes.add(outer);
|
|
247
|
+
transparentNodes.add(inner);
|
|
190
248
|
trigger.parentNode.insertBefore(outer, trigger);
|
|
191
249
|
outer.appendChild(inner);
|
|
192
|
-
inner
|
|
250
|
+
moveInto(inner, trigger);
|
|
193
251
|
pinRanges.add(inner);
|
|
194
252
|
return {
|
|
195
253
|
outer,
|
|
@@ -239,6 +297,7 @@ var StickyScrollTrigger = (function() {
|
|
|
239
297
|
"max-width",
|
|
240
298
|
"height",
|
|
241
299
|
"max-height",
|
|
300
|
+
"min-height",
|
|
242
301
|
"padding-top",
|
|
243
302
|
"padding-right",
|
|
244
303
|
"padding-bottom",
|
|
@@ -248,48 +307,65 @@ var StickyScrollTrigger = (function() {
|
|
|
248
307
|
"margin-bottom",
|
|
249
308
|
"margin-left"
|
|
250
309
|
];
|
|
310
|
+
const BLOCK_BOX = [
|
|
311
|
+
"height",
|
|
312
|
+
"max-height",
|
|
313
|
+
"min-height"
|
|
314
|
+
];
|
|
315
|
+
const PROBE_HEIGHT = "123456px";
|
|
316
|
+
const readHeldBox = (style, properties) => properties.map((property) => style.getPropertyValue(property.replace(/^m(ax|in)-/, "")));
|
|
317
|
+
const HELD_PRIORITY = "important";
|
|
251
318
|
const heldBoxes = new WeakMap();
|
|
252
|
-
const holdTriggerBox = (trigger, values) => {
|
|
253
|
-
const authored =
|
|
319
|
+
const holdTriggerBox = (trigger, properties, values) => {
|
|
320
|
+
const authored = properties.map((property) => captureInline(trigger, property));
|
|
254
321
|
heldBoxes.set(trigger, {
|
|
322
|
+
properties,
|
|
255
323
|
authored,
|
|
256
|
-
written:
|
|
324
|
+
written: properties.map((property, i) => writeInline(trigger, property, values[i], HELD_PRIORITY))
|
|
257
325
|
});
|
|
258
326
|
};
|
|
259
327
|
const releaseTriggerBox = (trigger) => {
|
|
260
328
|
const held = heldBoxes.get(trigger);
|
|
261
329
|
if (!held) return void 0;
|
|
262
|
-
|
|
263
|
-
restoreIfWritten(trigger, property, held.authored[i], held.written[i]);
|
|
330
|
+
held.properties.forEach((property, i) => {
|
|
331
|
+
restoreIfWritten(trigger, property, held.authored[i], held.written[i], HELD_PRIORITY);
|
|
264
332
|
});
|
|
265
333
|
heldBoxes.delete(trigger);
|
|
266
|
-
return held
|
|
334
|
+
return held;
|
|
267
335
|
};
|
|
268
336
|
const fitPinsToItems = (pins) => {
|
|
269
337
|
const held = pins.map(({ trigger }) => releaseTriggerBox(trigger));
|
|
338
|
+
const enclosing = pins.map(({ trigger }) => pins.filter((other) => other.trigger !== trigger && other.trigger.contains(trigger)));
|
|
339
|
+
const reserved = pins.map(() => void 0);
|
|
270
340
|
try {
|
|
271
|
-
|
|
341
|
+
for (let depth = Math.max(0, ...enclosing.map(({ length }) => length)); depth >= 0; depth--) {
|
|
342
|
+
const indexes = pins.flatMap((_, i) => enclosing[i].length === depth ? [i] : []);
|
|
343
|
+
const around = new Set(indexes.flatMap((i) => enclosing[i]));
|
|
344
|
+
fitReleasedPins(indexes.map((i) => pins[i]), [...around]).forEach((height, j) => {
|
|
345
|
+
reserved[indexes[j]] = height;
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
return reserved;
|
|
272
349
|
} catch (error) {
|
|
273
350
|
pins.forEach(({ trigger }, i) => {
|
|
274
|
-
const
|
|
275
|
-
|
|
351
|
+
const box = held[i];
|
|
352
|
+
releaseTriggerBox(trigger);
|
|
353
|
+
if (box) holdTriggerBox(trigger, box.properties, box.written);
|
|
276
354
|
});
|
|
277
355
|
throw error;
|
|
278
356
|
}
|
|
279
357
|
};
|
|
280
|
-
const fitReleasedPins = (pins) => {
|
|
358
|
+
const fitReleasedPins = (pins, around) => {
|
|
281
359
|
const styles = pins.map(({ trigger }) => getComputedStyle(trigger));
|
|
282
360
|
const layouts = pins.map(({ outer }, i) => itemLayout(outer, styles[i]));
|
|
283
|
-
const rendered = pins.map(({ trigger }
|
|
361
|
+
const rendered = pins.map(({ trigger }) => trigger.getClientRects().length > 0);
|
|
284
362
|
const copied = styles.map((style, i) => PIN_ITEM_PROPERTIES.map((property) => layouts[i] || property === "clear" && isBlockLevel(style) ? style[property] : ""));
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}] : [];
|
|
292
|
-
});
|
|
363
|
+
const measured = pins.flatMap((pin, index) => rendered[index] ? [{
|
|
364
|
+
...pin,
|
|
365
|
+
index,
|
|
366
|
+
layout: layouts[index]
|
|
367
|
+
}] : []);
|
|
368
|
+
const aroundDisplays = around.map(({ outer, inner }) => [outer.style.display, inner.style.display]);
|
|
293
369
|
pins.forEach(({ outer }, i) => {
|
|
294
370
|
outer.style.width = "";
|
|
295
371
|
PIN_ITEM_PROPERTIES.forEach((property, j) => {
|
|
@@ -297,41 +373,80 @@ var StickyScrollTrigger = (function() {
|
|
|
297
373
|
});
|
|
298
374
|
outer.style.display = rendered[i] ? "contents" : outerDisplay(layouts[i]);
|
|
299
375
|
});
|
|
300
|
-
|
|
376
|
+
[...measured, ...around].forEach(({ outer, inner }) => {
|
|
377
|
+
outer.style.display = "contents";
|
|
301
378
|
inner.style.display = "contents";
|
|
302
379
|
});
|
|
303
380
|
let boxes;
|
|
304
381
|
try {
|
|
305
|
-
boxes =
|
|
382
|
+
boxes = measured.map(({ trigger, index, layout }) => {
|
|
306
383
|
const style = styles[index];
|
|
384
|
+
if (!layout) return { box: readHeldBox(style, BLOCK_BOX) };
|
|
307
385
|
return {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
386
|
+
item: {
|
|
387
|
+
width: layout === "grid" ? void 0 : measureUsedWidth(trigger) + parseFloat(style.marginLeft) + parseFloat(style.marginRight),
|
|
388
|
+
height: marginBoxHeight(trigger, style)
|
|
389
|
+
},
|
|
390
|
+
box: readHeldBox(style, TRIGGER_BOX)
|
|
311
391
|
};
|
|
312
392
|
});
|
|
313
393
|
} finally {
|
|
314
|
-
|
|
394
|
+
measured.forEach(({ outer, inner, layout }) => {
|
|
315
395
|
outer.style.display = outerDisplay(layout);
|
|
316
396
|
inner.style.display = "";
|
|
317
397
|
});
|
|
398
|
+
around.forEach(({ outer, inner }, i) => {
|
|
399
|
+
[outer.style.display, inner.style.display] = aroundDisplays[i];
|
|
400
|
+
});
|
|
318
401
|
}
|
|
402
|
+
const inPx = boxes.map(({ box }) => box.every((value) => value.endsWith("px")));
|
|
403
|
+
const dependent = heightsFollowingInner(measured, boxes, inPx, styles);
|
|
319
404
|
const reserved = pins.map(() => void 0);
|
|
320
|
-
|
|
321
|
-
const {
|
|
405
|
+
measured.forEach(({ outer, trigger, index, layout }, i) => {
|
|
406
|
+
const { item, box } = boxes[i];
|
|
407
|
+
if (!item) {
|
|
408
|
+
if (inPx[i] && dependent.has(i)) holdTriggerBox(trigger, BLOCK_BOX, box);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const { width, height } = item;
|
|
322
412
|
if (!Number.isFinite(height) || width !== void 0 && !Number.isFinite(width)) return;
|
|
323
413
|
if (layout === "flex") outer.style.flex = "0 0 auto";
|
|
324
414
|
if (width !== void 0) outer.style.width = `${width}px`;
|
|
325
415
|
reserved[index] = height;
|
|
326
|
-
if (
|
|
416
|
+
if (inPx[i]) holdTriggerBox(trigger, TRIGGER_BOX, box);
|
|
327
417
|
});
|
|
328
418
|
return reserved;
|
|
329
419
|
};
|
|
420
|
+
const heightsFollowingInner = (measured, boxes, inPx, styles) => {
|
|
421
|
+
const blocks = measured.flatMap((pin, i) => !boxes[i].item && inPx[i] ? [{
|
|
422
|
+
...pin,
|
|
423
|
+
i
|
|
424
|
+
}] : []);
|
|
425
|
+
const dependent = new Set(probeInner(blocks, () => PROBE_HEIGHT, boxes));
|
|
426
|
+
const capped = blocks.filter(({ index, i }) => !dependent.has(i) && styles[index].maxHeight.includes("%"));
|
|
427
|
+
probeInner(capped, ({ i }) => boxes[i].box[0], boxes).forEach((i) => dependent.add(i));
|
|
428
|
+
return dependent;
|
|
429
|
+
};
|
|
430
|
+
const probeInner = (blocks, height, boxes) => {
|
|
431
|
+
const saved = blocks.map(({ outer, inner }) => [outer.style.height, inner.style.height]);
|
|
432
|
+
const outerHeights = blocks.map(({ outer }) => getComputedStyle(outer).height);
|
|
433
|
+
blocks.forEach((block, j) => {
|
|
434
|
+
block.outer.style.height = outerHeights[j];
|
|
435
|
+
block.inner.style.height = height(block);
|
|
436
|
+
});
|
|
437
|
+
try {
|
|
438
|
+
return blocks.flatMap(({ trigger, i }) => getComputedStyle(trigger).height !== boxes[i].box[0] ? [i] : []);
|
|
439
|
+
} finally {
|
|
440
|
+
blocks.forEach(({ outer, inner }, j) => {
|
|
441
|
+
[outer.style.height, inner.style.height] = saved[j];
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
};
|
|
330
445
|
const unwrapPin = (outer, trigger, saved) => {
|
|
331
446
|
const parent = outer.parentNode;
|
|
332
447
|
restoreInlinePosition(trigger, saved);
|
|
333
448
|
releaseTriggerBox(trigger);
|
|
334
|
-
if (parent) parent
|
|
449
|
+
if (parent) moveInto(parent, trigger, outer);
|
|
335
450
|
if (outer.firstElementChild instanceof HTMLElement) pinRanges.delete(outer.firstElementChild);
|
|
336
451
|
outer.remove();
|
|
337
452
|
};
|
|
@@ -1685,6 +1800,7 @@ var StickyScrollTrigger = (function() {
|
|
|
1685
1800
|
return finalPlans;
|
|
1686
1801
|
};
|
|
1687
1802
|
const OFFSET_PROPERTY = "--sst-scroll-margin-top-offset";
|
|
1803
|
+
const PRIORITY = "important";
|
|
1688
1804
|
const snapshots = new WeakMap();
|
|
1689
1805
|
let nextInstanceSuffix = 0;
|
|
1690
1806
|
const supportsScrollDrivenAnimations = typeof CSS !== "undefined" && typeof CSS.supports === "function" && CSS.supports("animation-timeline", "scroll()");
|
|
@@ -1725,7 +1841,7 @@ var StickyScrollTrigger = (function() {
|
|
|
1725
1841
|
if (usesJsRamp) window.addEventListener("scroll", onScroll, { passive: true });
|
|
1726
1842
|
const restoreTarget = (target) => {
|
|
1727
1843
|
const snapshot = snapshots.get(target);
|
|
1728
|
-
if (snapshot?.owner === instanceId) restoreIfWritten(target, "scroll-margin-top", snapshot.authored, snapshot.written);
|
|
1844
|
+
if (snapshot?.owner === instanceId) restoreIfWritten(target, "scroll-margin-top", snapshot.authored, snapshot.written, PRIORITY);
|
|
1729
1845
|
};
|
|
1730
1846
|
const stopRamps = () => {
|
|
1731
1847
|
if (sheet) {
|
|
@@ -1772,7 +1888,7 @@ var StickyScrollTrigger = (function() {
|
|
|
1772
1888
|
const naturalTops = measureNaturalTops(targets);
|
|
1773
1889
|
targets.forEach((target) => {
|
|
1774
1890
|
const existing = snapshots.get(target);
|
|
1775
|
-
if (existing && restoreIfWritten(target, "scroll-margin-top", existing.authored, existing.written)) return;
|
|
1891
|
+
if (existing && restoreIfWritten(target, "scroll-margin-top", existing.authored, existing.written, PRIORITY)) return;
|
|
1776
1892
|
snapshots.set(target, {
|
|
1777
1893
|
authored: captureInline(target, "scroll-margin-top"),
|
|
1778
1894
|
written: "",
|
|
@@ -1789,7 +1905,7 @@ var StickyScrollTrigger = (function() {
|
|
|
1789
1905
|
return `clamp(0px, (${margin}px - var(${OFFSET_PROPERTY}, 0px)) * 1000000, ${freezeEnd - freezeStart}px)`;
|
|
1790
1906
|
}).join(" + ");
|
|
1791
1907
|
const snapshot = snapshots.get(target);
|
|
1792
|
-
snapshot.written = writeInline(target, "scroll-margin-top", `calc(${authorPx}px + var(${OFFSET_PROPERTY}, 0px) + ${consumed} - (${lag}))
|
|
1908
|
+
snapshot.written = writeInline(target, "scroll-margin-top", `calc(${authorPx}px + var(${OFFSET_PROPERTY}, 0px) + ${consumed} - (${lag}))`, PRIORITY);
|
|
1793
1909
|
snapshot.owner = instanceId;
|
|
1794
1910
|
});
|
|
1795
1911
|
const next = new Set(targets);
|
|
@@ -1837,7 +1953,8 @@ var StickyScrollTrigger = (function() {
|
|
|
1837
1953
|
};
|
|
1838
1954
|
const unbuildStructure = (rootElement, layers, outermostContainer) => {
|
|
1839
1955
|
if (outermostContainer) {
|
|
1840
|
-
outermostContainer.parentNode
|
|
1956
|
+
const parent = outermostContainer.parentNode;
|
|
1957
|
+
if (parent) moveInto(parent, rootElement, outermostContainer);
|
|
1841
1958
|
outermostContainer.remove();
|
|
1842
1959
|
}
|
|
1843
1960
|
for (let i = layers.length - 1; i >= 0; i -= 1) {
|
|
@@ -1980,6 +2097,7 @@ var StickyScrollTrigger = (function() {
|
|
|
1980
2097
|
const armedInstances = new Set();
|
|
1981
2098
|
let lastScrollTriggerClass = null;
|
|
1982
2099
|
const REST_POLL_MS = 100;
|
|
2100
|
+
const refreshedDuringMove = new Map();
|
|
1983
2101
|
const runEach = (...steps) => {
|
|
1984
2102
|
let failure = null;
|
|
1985
2103
|
steps.forEach((step) => {
|
|
@@ -2009,6 +2127,7 @@ var StickyScrollTrigger = (function() {
|
|
|
2009
2127
|
#refreshInitNestedUsed = false;
|
|
2010
2128
|
#measureAgain = false;
|
|
2011
2129
|
#keepContentPending = false;
|
|
2130
|
+
#refreshOwed = false;
|
|
2012
2131
|
#deferredRun = null;
|
|
2013
2132
|
#restTimer = null;
|
|
2014
2133
|
#pendingKeep = null;
|
|
@@ -2487,10 +2606,11 @@ var StickyScrollTrigger = (function() {
|
|
|
2487
2606
|
const releaseScroll = resolvePinReleaseScroll(layer.endTrigger, classifiedEnd, toScroll(layer.trigger, triggerTop - topPx), viewportHeight, toScroll);
|
|
2488
2607
|
const height = releaseScroll - (this.#rootElement.contains(layer.trigger) ? dwellConsumedAt(releaseScroll, this.#engagedWindows()) : 0) - triggerTop + topPx + triggerHeight + triggerMarginBottom;
|
|
2489
2608
|
const room = documentHeight > 0 ? documentHeight - triggerTop : Infinity;
|
|
2609
|
+
const still = triggerHeight + triggerMarginBottom;
|
|
2490
2610
|
return [{
|
|
2491
2611
|
layer,
|
|
2492
2612
|
topPx,
|
|
2493
|
-
range: Math.max(0, Math.min(height, room))
|
|
2613
|
+
range: Math.max(0, Math.min(Math.max(height, still), room))
|
|
2494
2614
|
}];
|
|
2495
2615
|
});
|
|
2496
2616
|
}
|
|
@@ -2602,7 +2722,7 @@ var StickyScrollTrigger = (function() {
|
|
|
2602
2722
|
return evaluateLive(setUp, scroll, liveEnd);
|
|
2603
2723
|
}
|
|
2604
2724
|
refresh() {
|
|
2605
|
-
if (this.#depth > 0 || isRefreshing(this.#scrollTriggerClass) || this.#destroyed || !this.#armed || pendingDisarms.has(this) || window.scrollY === 0 || this.#measuresInPlace()) {
|
|
2725
|
+
if (this.#depth > 0 || isRefreshing(this.#scrollTriggerClass) || this.#destroyed || !this.#armed || pendingDisarms.has(this) || isMovingDom() || window.scrollY === 0 || this.#measuresInPlace()) {
|
|
2606
2726
|
this.#refreshFrom(false);
|
|
2607
2727
|
return;
|
|
2608
2728
|
}
|
|
@@ -2623,6 +2743,13 @@ var StickyScrollTrigger = (function() {
|
|
|
2623
2743
|
this.#runRefresh();
|
|
2624
2744
|
}
|
|
2625
2745
|
#runRefresh() {
|
|
2746
|
+
if (isMovingDom()) {
|
|
2747
|
+
const cls = isRefreshing(this.#scrollTriggerClass) ? this.#scrollTriggerClass : null;
|
|
2748
|
+
this.#refreshOwed = true;
|
|
2749
|
+
if (refreshedDuringMove.size === 0) queueMicrotask(StickyScrollTrigger.#runRefreshesOwed);
|
|
2750
|
+
refreshedDuringMove.set(this, refreshedDuringMove.get(this) ?? cls);
|
|
2751
|
+
return;
|
|
2752
|
+
}
|
|
2626
2753
|
if (this.#depth > 0) this.#measureAgain = true;
|
|
2627
2754
|
if (this.#destroyed || !this.#armed || pendingDisarms.has(this)) return;
|
|
2628
2755
|
let failure = null;
|
|
@@ -2639,6 +2766,7 @@ var StickyScrollTrigger = (function() {
|
|
|
2639
2766
|
if (this.#depth === 0) {
|
|
2640
2767
|
this.#refreshInitNestedUsed = false;
|
|
2641
2768
|
this.#measureAgain = false;
|
|
2769
|
+
this.#refreshOwed = false;
|
|
2642
2770
|
}
|
|
2643
2771
|
}
|
|
2644
2772
|
try {
|
|
@@ -2653,6 +2781,13 @@ var StickyScrollTrigger = (function() {
|
|
|
2653
2781
|
this.#scrollMarginSync?.applyRamps(realScroll() ?? scrollRecord(this.#scrollTriggerClass)?.read());
|
|
2654
2782
|
if (failure) throw failure.error;
|
|
2655
2783
|
}
|
|
2784
|
+
static #runRefreshesOwed() {
|
|
2785
|
+
const owed = [...refreshedDuringMove];
|
|
2786
|
+
refreshedDuringMove.clear();
|
|
2787
|
+
const classes = new Set(owed.flatMap(([, cls]) => cls ? [cls] : []));
|
|
2788
|
+
const direct = owed.flatMap(([instance, cls]) => !cls && instance.#refreshOwed ? [instance] : []);
|
|
2789
|
+
runEach(...[...classes].map((cls) => () => refreshAll(cls)), ...direct.map((instance) => () => instance.refresh()));
|
|
2790
|
+
}
|
|
2656
2791
|
#naturalScrollTop(layers) {
|
|
2657
2792
|
const measured = this.#measuredStructure;
|
|
2658
2793
|
const container = this.#outermostContainer;
|
|
@@ -2723,8 +2858,7 @@ var StickyScrollTrigger = (function() {
|
|
|
2723
2858
|
}
|
|
2724
2859
|
#liftCovers() {
|
|
2725
2860
|
this.#coverLayers().forEach((layer) => {
|
|
2726
|
-
|
|
2727
|
-
this.#coverRestoreByLayer.set(layer, liftAboveStickyWrapper(pin?.outer ?? layer.cover));
|
|
2861
|
+
this.#coverRestoreByLayer.set(layer, liftAboveStickyWrapper(physicalHolder(layer.cover)));
|
|
2728
2862
|
});
|
|
2729
2863
|
}
|
|
2730
2864
|
#syncScrollMargins(tops) {
|
|
@@ -2811,9 +2945,10 @@ var StickyScrollTrigger = (function() {
|
|
|
2811
2945
|
const trigger = resolveElement(triggerInput, "createOverlapScroll");
|
|
2812
2946
|
this.#assertTriggerInsideRoot(trigger, "createOverlapScroll");
|
|
2813
2947
|
const endTrigger = resolveEndTrigger(trigger, endTriggerInput, "createOverlapScroll");
|
|
2814
|
-
const
|
|
2815
|
-
|
|
2816
|
-
if (coverElement
|
|
2948
|
+
const ownWrappers = new Set(this.#coverLayers().flatMap(({ wrapper }) => wrapper ? [wrapper] : []));
|
|
2949
|
+
const coverElement = cover === void 0 ? logicalNextSibling(trigger, ownWrappers) : resolveElement(cover, "createOverlapScroll");
|
|
2950
|
+
if (!(coverElement instanceof HTMLElement)) throw new Error(`createOverlapScroll: cover element (trigger's next sibling) not found for trigger ${describeElement(trigger)}`);
|
|
2951
|
+
if (logicalParent(coverElement, ownWrappers) !== logicalParent(trigger, ownWrappers)) throw new Error(`createOverlapScroll: cover ${describeElement(coverElement)} must be a sibling of trigger ` + describeElement(trigger));
|
|
2817
2952
|
const layer = {
|
|
2818
2953
|
kind: "cover",
|
|
2819
2954
|
trigger,
|
|
@@ -2832,7 +2967,7 @@ var StickyScrollTrigger = (function() {
|
|
|
2832
2967
|
unbuildCover(layer);
|
|
2833
2968
|
onKill?.(self);
|
|
2834
2969
|
}, rest);
|
|
2835
|
-
this.#coverRestoreByLayer.set(layer, liftAboveStickyWrapper(coverElement));
|
|
2970
|
+
this.#coverRestoreByLayer.set(layer, liftAboveStickyWrapper(physicalHolder(coverElement)));
|
|
2836
2971
|
return vars;
|
|
2837
2972
|
}
|
|
2838
2973
|
createStickyPin({ trigger: triggerInput, start, top, endTrigger: endTriggerInput, end = "bottom top", onKill, ...rest }) {
|
|
@@ -2908,7 +3043,7 @@ var StickyScrollTrigger = (function() {
|
|
|
2908
3043
|
try {
|
|
2909
3044
|
return readThenRestore(StickyScrollTrigger.#resetStickyAround(null, [element]), () => documentTop(element));
|
|
2910
3045
|
} finally {
|
|
2911
|
-
restores.forEach((restore) => restore());
|
|
3046
|
+
restores.reverse().forEach((restore) => restore());
|
|
2912
3047
|
}
|
|
2913
3048
|
}
|
|
2914
3049
|
createResolvedTrigger({ trigger: triggerInput, start = "top bottom", end = "bottom top", endTrigger: endTriggerInput, ...rest }) {
|