@glitchr/stickyjs 1.0.12 → 1.0.13

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 +5 -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.13",
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;