@glitchr/stickyjs 1.0.42 → 1.0.43

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 +11 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glitchr/stickyjs",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "Sticky scroll library",
5
5
  "main": "src/index.js",
6
6
  "repository": {
package/src/js/sticky.js CHANGED
@@ -694,16 +694,16 @@ $.fn.serializeObject = function () {
694
694
  var maxScrollY = $(el).prop("scrollHeight") - Math.round($(el).prop("clientHeight"));
695
695
  if (maxScrollY == 0) maxScrollY = Math.round($(el).prop("clientHeight"));
696
696
 
697
- scrollTop = Math.max(0, Math.min(dict["top"] ?? $(el).prop("scrollTop"), maxScrollY));
698
- scrollLeft = Math.max(0, Math.min(dict["left"] ?? $(el).prop("scrollLeft"), maxScrollX));
697
+ var scrollTop = Math.max(0, Math.min(dict["top"] ?? $(el).prop("scrollTop"), maxScrollY));
698
+ var scrollLeft = Math.max(0, Math.min(dict["left"] ?? $(el).prop("scrollLeft"), maxScrollX));
699
699
 
700
- speed = parseFloat(dict["speed"] ?? 0);
701
- easing = dict["easing"] ?? "swing";
702
- debounce = dict["debounce"] ?? 0;
700
+ var speed = parseFloat(dict["speed"] ?? 0);
701
+ var easing = dict["easing"] ?? "swing";
702
+ var debounce = dict["debounce"] ?? 0;
703
703
 
704
- duration = 1000*Sticky.parseDuration(dict["duration"] ?? 0);
705
- durationX = 1000*Sticky.parseDuration(dict["duration-x"] ?? dict["duration"] ?? 0);
706
- durationY = 1000*Sticky.parseDuration(dict["duration-y"] ?? dict["duration"] ?? 0);
704
+ var duration = 1000*Sticky.parseDuration(dict["duration"] ?? 0);
705
+ var durationX = 1000*Sticky.parseDuration(dict["duration-x"] ?? dict["duration"] ?? 0);
706
+ var durationY = 1000*Sticky.parseDuration(dict["duration-y"] ?? dict["duration"] ?? 0);
707
707
 
708
708
  if(speed) {
709
709
 
@@ -1144,16 +1144,15 @@ $.fn.serializeObject = function () {
1144
1144
  var hash = null;
1145
1145
  if(Settings.debug > 1) console.log("Sticky headlines:", $(ids));
1146
1146
 
1147
- var elAll = $(ids).filter(function() {
1148
1147
 
1148
+ var elAll = $(ids).filter(function() {
1149
1149
  if(this === $(Settings.identifier)) return false;
1150
1150
  return this.getBoundingClientRect().top < Sticky.getScrollPadding(scroller).top + 1;
1151
-
1152
- }).sort(function (el1, el2) {
1153
-
1151
+ }).toArray().sort(function (el1, el2) {
1154
1152
  return el1.offsetTop > el2.offsetTop ? -1
1155
1153
  : (el1.offsetTop < el2.offsetTop ? 1 : 0);
1156
1154
  });
1155
+ elAll = $(elAll); // re-wrap as jQuery so .filter (with `this` as element) and .has() work below
1157
1156
 
1158
1157
  var el = elAll.filter(function() {
1159
1158