@glitchr/stickyjs 1.0.45 → 1.0.50
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/package.json +1 -1
- package/src/js/sticky.js +14 -1
package/package.json
CHANGED
package/src/js/sticky.js
CHANGED
|
@@ -677,7 +677,20 @@ $.fn.serializeObject = function () {
|
|
|
677
677
|
return parseInt(closest);
|
|
678
678
|
}
|
|
679
679
|
|
|
680
|
-
Sticky.userScroll = function(el = undefined) {
|
|
680
|
+
Sticky.userScroll = function(el = undefined) {
|
|
681
|
+
// Defensive: closestScrollable() can return a value without .prop in
|
|
682
|
+
// some race conditions (transient DOM during transparent.js page
|
|
683
|
+
// transitions, sticky-scrollpercent triggers fired against detached
|
|
684
|
+
// nodes). Default to true so the autoscroll falls back to "user is
|
|
685
|
+
// scrolling, don't auto-advance."
|
|
686
|
+
try {
|
|
687
|
+
var $target = $(el === undefined ? document.documentElement : el);
|
|
688
|
+
if (!$target || !$target.length) return true;
|
|
689
|
+
var $scroll = $target.closestScrollable && $target.closestScrollable();
|
|
690
|
+
if (!$scroll || typeof $scroll.prop !== "function") return true;
|
|
691
|
+
return $scroll.prop("user-scroll") ?? true;
|
|
692
|
+
} catch (e) { return true; }
|
|
693
|
+
}
|
|
681
694
|
Sticky.scrollTo = function(dict, callback = function() {}, el = window)
|
|
682
695
|
{
|
|
683
696
|
el = $(el).length ? $(el)[0] : window;
|