@glitchr/stickyjs 1.0.31 → 1.0.33
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/css/index.css +2 -2
- package/src/js/sticky.js +24 -22
package/package.json
CHANGED
package/src/css/index.css
CHANGED
|
@@ -70,11 +70,11 @@ html { scroll-behavior: unset !important; }
|
|
|
70
70
|
opacity:0;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
.sticky-autoscroll
|
|
73
|
+
/* .sticky-autoscroll
|
|
74
74
|
{
|
|
75
75
|
max-height: 100vh;
|
|
76
76
|
max-width: 100vw;
|
|
77
|
-
}
|
|
77
|
+
} */
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
.sticky-swipehint:not(.sticky-swipehint-reveal) .sticky-swipehint-container { display:none; }
|
package/src/js/sticky.js
CHANGED
|
@@ -936,7 +936,8 @@ $.fn.serializeObject = function () {
|
|
|
936
936
|
var classList = e.target.length ? e.target[0].classList : [];
|
|
937
937
|
classList.forEach(function(className) {
|
|
938
938
|
|
|
939
|
-
|
|
939
|
+
target = e.target[0] == $("html")[0] ? window : e.target[0];
|
|
940
|
+
if(!(target in trigger)) trigger[target] = {};
|
|
940
941
|
|
|
941
942
|
var regex = /sticky-scrollpercent(?:-(from|every|once)){0,1}-(\d+)([udlr]){0,1}/gi;
|
|
942
943
|
if( (match = regex.exec(className)) ) {
|
|
@@ -957,19 +958,19 @@ $.fn.serializeObject = function () {
|
|
|
957
958
|
|
|
958
959
|
var scrollPercentX = scrollDirX == "left" ? 100-scrollPercent : scrollPercent;
|
|
959
960
|
|
|
960
|
-
if(!(className in trigger[
|
|
961
|
+
if(!(className in trigger[target])) trigger[target][className] = true;
|
|
961
962
|
|
|
962
963
|
if(scrollTrigger == "from" && scrollDirX == e.scrollX.direction && e.scrollX.percent >= scrollPercentX)
|
|
963
|
-
|
|
964
|
-
if(scrollTrigger == "once" && scrollDirX == e.scrollX.direction && e.scrollX.percent >= scrollPercentX && trigger[
|
|
965
|
-
|
|
964
|
+
target.dispatchEvent(new CustomEvent("scrollpercent", {detail: {scroll:e, trigger:0, dir:scrollDirX, percent:scrollPercentX}}));
|
|
965
|
+
if(scrollTrigger == "once" && scrollDirX == e.scrollX.direction && e.scrollX.percent >= scrollPercentX && trigger[target][className])
|
|
966
|
+
target.dispatchEvent(new CustomEvent("scrollpercent", {detail: {scroll:e, trigger:1, dir:scrollDirX, percent:scrollPercentX}}));
|
|
966
967
|
|
|
967
968
|
if(scrollTrigger == "every" && scrollDirX == e.scrollX.direction && e.scrollX.percent < scrollPercentX )
|
|
968
|
-
trigger[
|
|
969
|
-
if(scrollTrigger == "every" && scrollDirX == e.scrollX.direction && e.scrollX.percent >= scrollPercentX && trigger[
|
|
970
|
-
|
|
969
|
+
trigger[target][className] = true;
|
|
970
|
+
if(scrollTrigger == "every" && scrollDirX == e.scrollX.direction && e.scrollX.percent >= scrollPercentX && trigger[target][className])
|
|
971
|
+
target.dispatchEvent(new CustomEvent("scrollpercent", {detail: {scroll:e, trigger:2, dir:scrollDirX, percent:scrollPercentX}}));
|
|
971
972
|
|
|
972
|
-
trigger[
|
|
973
|
+
trigger[target][className] = (scrollTrigger == "every" && e.scrollX.percent < scrollPercentX);
|
|
973
974
|
}
|
|
974
975
|
}
|
|
975
976
|
|
|
@@ -980,15 +981,15 @@ $.fn.serializeObject = function () {
|
|
|
980
981
|
|
|
981
982
|
var scrollPercentY = scrollDirY == "up" ? 100-scrollPercent : scrollPercent;
|
|
982
983
|
|
|
983
|
-
if(!className in trigger[
|
|
984
|
+
if(!className in trigger[target]) trigger[target][className] = true;
|
|
984
985
|
if(scrollTrigger == "from" && scrollDirY == e.scrollY.direction && e.scrollY.percent >= scrollPercentY)
|
|
985
|
-
|
|
986
|
-
if(scrollTrigger == "once" && scrollDirY == e.scrollY.direction && e.scrollY.percent >= scrollPercentY && trigger[
|
|
987
|
-
|
|
988
|
-
if(scrollTrigger == "every" && scrollDirY == e.scrollY.direction && e.scrollY.percent >= scrollPercentY && trigger[
|
|
989
|
-
|
|
986
|
+
target.dispatchEvent(new CustomEvent("scrollpercent", {detail: {scroll:e, trigger:0, dir:scrollDirY, percent:scrollPercentY}}));
|
|
987
|
+
if(scrollTrigger == "once" && scrollDirY == e.scrollY.direction && e.scrollY.percent >= scrollPercentY && trigger[target][className])
|
|
988
|
+
target.dispatchEvent(new CustomEvent("scrollpercent", {detail: {scroll:e, trigger:1, dir:scrollDirY, percent:scrollPercentY}}));
|
|
989
|
+
if(scrollTrigger == "every" && scrollDirY == e.scrollY.direction && e.scrollY.percent >= scrollPercentY && trigger[target][className])
|
|
990
|
+
target.dispatchEvent(new CustomEvent("scrollpercent", {detail: {scroll:e, trigger:2, dir:scrollDirY, percent:scrollPercentY}}));
|
|
990
991
|
|
|
991
|
-
trigger[
|
|
992
|
+
trigger[target][className] = (scrollTrigger == "every" && e.scrollY.percent < scrollPercentY);
|
|
992
993
|
}
|
|
993
994
|
}
|
|
994
995
|
}
|
|
@@ -1000,7 +1001,7 @@ $.fn.serializeObject = function () {
|
|
|
1000
1001
|
var scrollSnapDebounce = false;
|
|
1001
1002
|
Sticky.onScrollSnap = function (e)
|
|
1002
1003
|
{
|
|
1003
|
-
if (Settings.debug) console.log(
|
|
1004
|
+
if (Settings.debug) console.log("Sticky magnetic:", scrollSnap, scrollSnapStart, scrollSnapProximity);
|
|
1004
1005
|
if(!Settings.ready) return;
|
|
1005
1006
|
|
|
1006
1007
|
if(Sticky.get("passive") == true) return;
|
|
@@ -1138,7 +1139,7 @@ $.fn.serializeObject = function () {
|
|
|
1138
1139
|
if (ids.length == 0) return;
|
|
1139
1140
|
|
|
1140
1141
|
var hash = null;
|
|
1141
|
-
if(Settings.debug) console.log(
|
|
1142
|
+
if(Settings.debug) console.log("Sticky headlines:", $(ids));
|
|
1142
1143
|
|
|
1143
1144
|
var elAll = $(ids).filter(function() {
|
|
1144
1145
|
|
|
@@ -1449,7 +1450,7 @@ $.fn.serializeObject = function () {
|
|
|
1449
1450
|
: !isAbove && (top + this.clientHeight + extraEaseIn < 0) &&
|
|
1450
1451
|
!isBelow && (bottom - this.clientHeight - extraEaseIn > 0);
|
|
1451
1452
|
|
|
1452
|
-
if(Settings.debug) console.log(
|
|
1453
|
+
if(Settings.debug) console.log("Sticky ease-in:",isAbove,isBelow,isBetween);
|
|
1453
1454
|
show = (!isAbove && !isBelow);
|
|
1454
1455
|
|
|
1455
1456
|
} else if(e.first) show = true;
|
|
@@ -1464,7 +1465,7 @@ $.fn.serializeObject = function () {
|
|
|
1464
1465
|
: !isAbove && (top + this.clientHeight + extraEaseOut < 0) &&
|
|
1465
1466
|
!isBelow && (bottom - this.clientHeight - extraEaseOut > 0);
|
|
1466
1467
|
|
|
1467
|
-
if(Settings.debug) console.log(
|
|
1468
|
+
if(Settings.debug) console.log("Sticky ease-out:",isAbove,isBelow,isBetween);
|
|
1468
1469
|
show = !isAbove && !isBelow;
|
|
1469
1470
|
|
|
1470
1471
|
}
|
|
@@ -1559,8 +1560,9 @@ $.fn.serializeObject = function () {
|
|
|
1559
1560
|
(noScrollX && !autoscrollY) ||
|
|
1560
1561
|
(!autoscrollX && !autoscrollY)) return;
|
|
1561
1562
|
|
|
1562
|
-
if (
|
|
1563
|
-
console.error(this, "is not scrollable: autoscroll canceled");
|
|
1563
|
+
if (!$(this).isScrollable()) {
|
|
1564
|
+
if(Settings.debug) console.error(this, "is not scrollable: autoscroll canceled");
|
|
1565
|
+
}
|
|
1564
1566
|
|
|
1565
1567
|
if(reverse && $(this).scrollLeft() == 0 && $(this).scrollTop() == 0)
|
|
1566
1568
|
reverse = !reverse;
|