@glitchr/stickyjs 1.0.12 → 1.0.14

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 +9 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glitchr/stickyjs",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Sticky scroll library",
5
5
  "main": "src/index.js",
6
6
  "repository": {
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.5,
199
+ "scrollhint" : 0.25,
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 = window.getComputedStyle(scroller);
284
+ var style = scroller instanceof Element ? window.getComputedStyle(scroller) : {};
285
285
 
286
286
  var dict = {};
287
287
  dict["top" ] = Sticky.parseToPixel(style["scroll-padding-top" ] || 0, scroller);
@@ -407,12 +407,13 @@ $.fn.serializeObject = function () {
407
407
 
408
408
  event.target = $(event.target);
409
409
  event.target = $(event.target).isScrollable() ? event.target : $(event.target).closestScrollable();
410
+
410
411
  if(event.target.length == 0) return event;
411
412
 
412
413
  if ($(event.target).prop("user-scroll") === undefined)
413
414
  $(event.target).prop("user-scroll", true);
414
415
 
415
- var targetData = jQuery.data(event.target);
416
+ var targetData = jQuery.data(event.target[0]);
416
417
  var first = (Object.keys(targetData).length === 0);
417
418
 
418
419
  var top = targetData.top || 0;
@@ -1132,7 +1133,7 @@ $.fn.serializeObject = function () {
1132
1133
  if(e.reset) hasReset = true;
1133
1134
  if(scrollHint) {
1134
1135
 
1135
- if(e.scrollY.delta < 0) {
1136
+ if(!e.scrollY.bottomElastic) {
1136
1137
  $(this).removeClass("hint");
1137
1138
  $(this).off("click.hint");
1138
1139
  hasReset = false;
@@ -1551,6 +1552,7 @@ $.fn.serializeObject = function () {
1551
1552
  // Mouse events
1552
1553
  if (mouseAction) {
1553
1554
 
1555
+ $(scroller).off("mouseenter.autoscroll touchstart.autoscroll");
1554
1556
  $(scroller).on("mouseenter.autoscroll touchstart.autoscroll", function() {
1555
1557
 
1556
1558
  if(autoscrollTimeout != undefined) clearTimeout(autoscrollTimeout);
@@ -1558,6 +1560,7 @@ $.fn.serializeObject = function () {
1558
1560
  $(scroller).stop();
1559
1561
  });
1560
1562
 
1563
+ $(scroller).on("mouseleave.autoscroll touchend.autoscroll");
1561
1564
  $(scroller).on("mouseleave.autoscroll touchend.autoscroll", function() {
1562
1565
 
1563
1566
  if(startOver) payloadAutoscroll();
@@ -1568,6 +1571,7 @@ $.fn.serializeObject = function () {
1568
1571
  }
1569
1572
  });
1570
1573
 
1574
+ $(scroller).on("onbeforeunload.autoscroll");
1571
1575
  $(scroller).on("onbeforeunload.autoscroll", function() {
1572
1576
 
1573
1577
  $(this).off("mousewheel.autoscroll touchstart.autoscroll");
@@ -1589,6 +1593,7 @@ $.fn.serializeObject = function () {
1589
1593
  var scrollWidth = $(scroller).prop('scrollWidth') - scroller.innerWidth();
1590
1594
  var scrollHeight = $(scroller).prop('scrollHeight') - scroller.innerHeight();
1591
1595
 
1596
+ $(scroller).off("wheel.autoscroll DOMMouseScroll.autoscroll mousewheel.autoscroll touchstart.autoscroll");
1592
1597
  $(scroller).on("wheel.autoscroll DOMMouseScroll.autoscroll mousewheel.autoscroll touchstart.autoscroll", function(e) {
1593
1598
 
1594
1599
  $(this).prop("user-scroll", true);