@glitchr/stickyjs 1.0.17 → 1.0.18
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 +3 -3
- package/src/js/sticky.js +13 -36
package/package.json
CHANGED
package/src/css/index.css
CHANGED
|
@@ -106,20 +106,20 @@ html { scroll-behavior: unset !important; }
|
|
|
106
106
|
padding:1em;
|
|
107
107
|
|
|
108
108
|
object-fit:cover;
|
|
109
|
-
animation:
|
|
109
|
+
animation:blink normal 4s infinite ease-in-out;
|
|
110
110
|
|
|
111
111
|
backdrop-filter: blur(5px);
|
|
112
112
|
-webkit-backdrop-filter: blur(5px);
|
|
113
113
|
background-color:#FFF5;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
@keyframes
|
|
116
|
+
@keyframes blink {
|
|
117
117
|
0% { opacity: 0; }
|
|
118
118
|
25% { opacity: 1; }
|
|
119
119
|
50% { opacity: 1; }
|
|
120
120
|
100% { opacity: 0; }
|
|
121
121
|
}
|
|
122
|
-
@-webkit-keyframes
|
|
122
|
+
@-webkit-keyframes blink {
|
|
123
123
|
0% { opacity: 0; }
|
|
124
124
|
25% { opacity: 1; }
|
|
125
125
|
50% { opacity: 1; }
|
package/src/js/sticky.js
CHANGED
|
@@ -196,7 +196,7 @@ $.fn.serializeObject = function () {
|
|
|
196
196
|
"scrollcatch": false,
|
|
197
197
|
"scrolllock" : true,
|
|
198
198
|
"scrollhide" : true,
|
|
199
|
-
"scrollhint" : 0.
|
|
199
|
+
"scrollhint" : 0.5,
|
|
200
200
|
|
|
201
201
|
//
|
|
202
202
|
// Manual overscroll detection (browser compatibility, e.g. scroll event missing with Firefox)
|
|
@@ -281,7 +281,7 @@ $.fn.serializeObject = function () {
|
|
|
281
281
|
Sticky.getScrollPadding = function(el = document.documentElement) {
|
|
282
282
|
|
|
283
283
|
var scroller = $(el).closestScrollable()[0];
|
|
284
|
-
var style
|
|
284
|
+
var style = window.getComputedStyle(scroller);
|
|
285
285
|
|
|
286
286
|
var dict = {};
|
|
287
287
|
dict["top" ] = Sticky.parseToPixel(style["scroll-padding-top" ] || 0, scroller);
|
|
@@ -407,13 +407,12 @@ $.fn.serializeObject = function () {
|
|
|
407
407
|
|
|
408
408
|
event.target = $(event.target);
|
|
409
409
|
event.target = $(event.target).isScrollable() ? event.target : $(event.target).closestScrollable();
|
|
410
|
-
|
|
411
410
|
if(event.target.length == 0) return event;
|
|
412
411
|
|
|
413
412
|
if ($(event.target).prop("user-scroll") === undefined)
|
|
414
413
|
$(event.target).prop("user-scroll", true);
|
|
415
414
|
|
|
416
|
-
var targetData = jQuery.data(event.target
|
|
415
|
+
var targetData = jQuery.data(event.target);
|
|
417
416
|
var first = (Object.keys(targetData).length === 0);
|
|
418
417
|
|
|
419
418
|
var top = targetData.top || 0;
|
|
@@ -946,7 +945,6 @@ $.fn.serializeObject = function () {
|
|
|
946
945
|
});
|
|
947
946
|
}
|
|
948
947
|
|
|
949
|
-
var first = true;
|
|
950
948
|
var hasReset = false;
|
|
951
949
|
Sticky.onScrollDelta = function (e) {
|
|
952
950
|
|
|
@@ -1023,11 +1021,6 @@ $.fn.serializeObject = function () {
|
|
|
1023
1021
|
|
|
1024
1022
|
if(Sticky.userScroll(el) || $(el).hasClass("sticky-magnet") || (hash == null && elAll.length == 0)) {
|
|
1025
1023
|
|
|
1026
|
-
if(first) {
|
|
1027
|
-
first = false;
|
|
1028
|
-
return;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
1024
|
window.replaceHash(hash, false, false);
|
|
1032
1025
|
dispatchEvent(new HashChangeEvent("hashchange"))
|
|
1033
1026
|
}
|
|
@@ -1133,7 +1126,7 @@ $.fn.serializeObject = function () {
|
|
|
1133
1126
|
if(e.reset) hasReset = true;
|
|
1134
1127
|
if(scrollHint) {
|
|
1135
1128
|
|
|
1136
|
-
if(
|
|
1129
|
+
if(e.scrollY.delta < 0) {
|
|
1137
1130
|
$(this).removeClass("hint");
|
|
1138
1131
|
$(this).off("click.hint");
|
|
1139
1132
|
hasReset = false;
|
|
@@ -1340,16 +1333,8 @@ $.fn.serializeObject = function () {
|
|
|
1340
1333
|
return this;
|
|
1341
1334
|
}
|
|
1342
1335
|
|
|
1343
|
-
|
|
1344
1336
|
Sticky.onAutoscroll = function() {
|
|
1345
1337
|
|
|
1346
|
-
var container = this;
|
|
1347
|
-
var scroller = $(container); //.closestScrollable();
|
|
1348
|
-
|
|
1349
|
-
function parseBoolean(str) {
|
|
1350
|
-
return /true/i.test(str);
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
1338
|
if ($(this).data("autoscroll-prevent")) {
|
|
1354
1339
|
|
|
1355
1340
|
$(this).closestScrollableWindow().off("scrolldelta.autoscroll");
|
|
@@ -1374,11 +1359,8 @@ $.fn.serializeObject = function () {
|
|
|
1374
1359
|
|
|
1375
1360
|
var autoscrollX = $(this).data("autoscroll-x");
|
|
1376
1361
|
if(autoscrollX == undefined) autoscrollX = Sticky.get("autoscroll");
|
|
1377
|
-
autoscrollX = parseBoolean(autoscrollX);
|
|
1378
|
-
|
|
1379
1362
|
var autoscrollY = $(this).data("autoscroll-y");
|
|
1380
1363
|
if(autoscrollY == undefined) autoscrollY = Sticky.get("autoscroll");
|
|
1381
|
-
autoscrollY = parseBoolean(autoscrollY);
|
|
1382
1364
|
|
|
1383
1365
|
var thresholdMinX = $(this).data("autoscroll-minwidth");
|
|
1384
1366
|
if(thresholdMinX == undefined) thresholdMinX = Sticky.get("autoscroll_minwidth");
|
|
@@ -1426,18 +1408,18 @@ $.fn.serializeObject = function () {
|
|
|
1426
1408
|
|
|
1427
1409
|
Sticky.scrollTo(scrollOptions, function() {
|
|
1428
1410
|
|
|
1429
|
-
if( !bouncing || $(
|
|
1411
|
+
if( !bouncing || $(this).data("autoscroll-prevent") ) return;
|
|
1430
1412
|
|
|
1431
|
-
$(
|
|
1413
|
+
$(this).prop("user-scroll", true);
|
|
1432
1414
|
Sticky.scrollTo(scrollBackOptions, function() {
|
|
1433
1415
|
|
|
1434
|
-
Sticky.onAutoscroll.call(
|
|
1435
|
-
if(reverse) $(
|
|
1436
|
-
else $(
|
|
1416
|
+
Sticky.onAutoscroll.call(this);
|
|
1417
|
+
if(reverse) $(this).removeData("autoscroll-reverse");
|
|
1418
|
+
else $(this).data("autoscroll-reverse", true);
|
|
1437
1419
|
|
|
1438
|
-
}.bind(this),
|
|
1420
|
+
}.bind(this), this)
|
|
1439
1421
|
|
|
1440
|
-
}.bind(this),
|
|
1422
|
+
}.bind(this), this);
|
|
1441
1423
|
|
|
1442
1424
|
return this;
|
|
1443
1425
|
|
|
@@ -1516,8 +1498,7 @@ $.fn.serializeObject = function () {
|
|
|
1516
1498
|
|
|
1517
1499
|
$(".sticky-autoscroll").each(function() {
|
|
1518
1500
|
|
|
1519
|
-
var
|
|
1520
|
-
var scroller = $(container); //.closestScrollable();
|
|
1501
|
+
var scroller = $(this).closestScrollable();
|
|
1521
1502
|
|
|
1522
1503
|
var reverseDelay = $(scroller).data("autoscroll-delay-reverse");
|
|
1523
1504
|
if (reverseDelay == undefined) reverseDelay = Sticky.get("autoscroll_delay_reverse");
|
|
@@ -1557,14 +1538,13 @@ $.fn.serializeObject = function () {
|
|
|
1557
1538
|
var payloadAutoscroll = function() {
|
|
1558
1539
|
|
|
1559
1540
|
if(autoscrollTimeout != undefined) clearTimeout(autoscrollTimeout);
|
|
1560
|
-
autoscrollTimeout = setTimeout(() => Sticky.onAutoscroll.call(
|
|
1541
|
+
autoscrollTimeout = setTimeout(() => Sticky.onAutoscroll.call(scroller), 1000*Sticky.parseDuration(delay) + 1);
|
|
1561
1542
|
};
|
|
1562
1543
|
|
|
1563
1544
|
//
|
|
1564
1545
|
// Mouse events
|
|
1565
1546
|
if (mouseAction) {
|
|
1566
1547
|
|
|
1567
|
-
$(scroller).off("mouseenter.autoscroll touchstart.autoscroll");
|
|
1568
1548
|
$(scroller).on("mouseenter.autoscroll touchstart.autoscroll", function() {
|
|
1569
1549
|
|
|
1570
1550
|
if(autoscrollTimeout != undefined) clearTimeout(autoscrollTimeout);
|
|
@@ -1572,7 +1552,6 @@ $.fn.serializeObject = function () {
|
|
|
1572
1552
|
$(scroller).stop();
|
|
1573
1553
|
});
|
|
1574
1554
|
|
|
1575
|
-
$(scroller).on("mouseleave.autoscroll touchend.autoscroll");
|
|
1576
1555
|
$(scroller).on("mouseleave.autoscroll touchend.autoscroll", function() {
|
|
1577
1556
|
|
|
1578
1557
|
if(startOver) payloadAutoscroll();
|
|
@@ -1583,7 +1562,6 @@ $.fn.serializeObject = function () {
|
|
|
1583
1562
|
}
|
|
1584
1563
|
});
|
|
1585
1564
|
|
|
1586
|
-
$(scroller).on("onbeforeunload.autoscroll");
|
|
1587
1565
|
$(scroller).on("onbeforeunload.autoscroll", function() {
|
|
1588
1566
|
|
|
1589
1567
|
$(this).off("mousewheel.autoscroll touchstart.autoscroll");
|
|
@@ -1605,7 +1583,6 @@ $.fn.serializeObject = function () {
|
|
|
1605
1583
|
var scrollWidth = $(scroller).prop('scrollWidth') - scroller.innerWidth();
|
|
1606
1584
|
var scrollHeight = $(scroller).prop('scrollHeight') - scroller.innerHeight();
|
|
1607
1585
|
|
|
1608
|
-
$(scroller).off("wheel.autoscroll DOMMouseScroll.autoscroll mousewheel.autoscroll touchstart.autoscroll");
|
|
1609
1586
|
$(scroller).on("wheel.autoscroll DOMMouseScroll.autoscroll mousewheel.autoscroll touchstart.autoscroll", function(e) {
|
|
1610
1587
|
|
|
1611
1588
|
$(this).prop("user-scroll", true);
|