@glitchr/stickyjs 1.0.14 → 1.0.16

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/js/sticky.js +21 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glitchr/stickyjs",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "Sticky scroll library",
5
5
  "main": "src/index.js",
6
6
  "repository": {
package/src/js/sticky.js CHANGED
@@ -1340,8 +1340,16 @@ $.fn.serializeObject = function () {
1340
1340
  return this;
1341
1341
  }
1342
1342
 
1343
+
1343
1344
  Sticky.onAutoscroll = function() {
1344
1345
 
1346
+ var container = this;
1347
+ var scroller = $(container); //.closestScrollable();
1348
+
1349
+ function parseBoolean(str) {
1350
+ return /true/i.test(str);
1351
+ }
1352
+
1345
1353
  if ($(this).data("autoscroll-prevent")) {
1346
1354
 
1347
1355
  $(this).closestScrollableWindow().off("scrolldelta.autoscroll");
@@ -1366,8 +1374,11 @@ $.fn.serializeObject = function () {
1366
1374
 
1367
1375
  var autoscrollX = $(this).data("autoscroll-x");
1368
1376
  if(autoscrollX == undefined) autoscrollX = Sticky.get("autoscroll");
1377
+ autoscrollX = parseBoolean(autoscrollX);
1378
+
1369
1379
  var autoscrollY = $(this).data("autoscroll-y");
1370
1380
  if(autoscrollY == undefined) autoscrollY = Sticky.get("autoscroll");
1381
+ autoscrollY = parseBoolean(autoscrollY);
1371
1382
 
1372
1383
  var thresholdMinX = $(this).data("autoscroll-minwidth");
1373
1384
  if(thresholdMinX == undefined) thresholdMinX = Sticky.get("autoscroll_minwidth");
@@ -1415,18 +1426,18 @@ $.fn.serializeObject = function () {
1415
1426
 
1416
1427
  Sticky.scrollTo(scrollOptions, function() {
1417
1428
 
1418
- if( !bouncing || $(this).data("autoscroll-prevent") ) return;
1429
+ if( !bouncing || $(container).data("autoscroll-prevent") ) return;
1419
1430
 
1420
- $(this).prop("user-scroll", true);
1431
+ $(scroller).prop("user-scroll", true);
1421
1432
  Sticky.scrollTo(scrollBackOptions, function() {
1422
1433
 
1423
- Sticky.onAutoscroll.call(this);
1424
- if(reverse) $(this).removeData("autoscroll-reverse");
1425
- else $(this).data("autoscroll-reverse", true);
1434
+ Sticky.onAutoscroll.call(container);
1435
+ if(reverse) $(container).removeData("autoscroll-reverse");
1436
+ else $(container).data("autoscroll-reverse", true);
1426
1437
 
1427
- }.bind(this), this)
1438
+ }.bind(this), scroller)
1428
1439
 
1429
- }.bind(this), this);
1440
+ }.bind(this), scroller);
1430
1441
 
1431
1442
  return this;
1432
1443
 
@@ -1505,7 +1516,8 @@ $.fn.serializeObject = function () {
1505
1516
 
1506
1517
  $(".sticky-autoscroll").each(function() {
1507
1518
 
1508
- var scroller = $(this).closestScrollable();
1519
+ var container = this;
1520
+ var scroller = $(container); //.closestScrollable();
1509
1521
 
1510
1522
  var reverseDelay = $(scroller).data("autoscroll-delay-reverse");
1511
1523
  if (reverseDelay == undefined) reverseDelay = Sticky.get("autoscroll_delay_reverse");
@@ -1545,7 +1557,7 @@ $.fn.serializeObject = function () {
1545
1557
  var payloadAutoscroll = function() {
1546
1558
 
1547
1559
  if(autoscrollTimeout != undefined) clearTimeout(autoscrollTimeout);
1548
- autoscrollTimeout = setTimeout(() => Sticky.onAutoscroll.call(scroller), 1000*Sticky.parseDuration(delay) + 1);
1560
+ autoscrollTimeout = setTimeout(() => Sticky.onAutoscroll.call(container), 1000*Sticky.parseDuration(delay) + 1);
1549
1561
  };
1550
1562
 
1551
1563
  //