Comparing version 1.2.13 to 1.2.15
@@ -10,3 +10,4 @@ (function (global, factory) { | ||
win: window, | ||
attribute: 'data-scrolldir' | ||
attribute: 'data-scrolldir', | ||
dir: 'down' | ||
}; | ||
@@ -16,2 +17,3 @@ var el = void 0; | ||
var attribute = void 0; | ||
var dir = void 0; // 'up' or 'down' | ||
var body = document.body; | ||
@@ -22,3 +24,2 @@ var historyLength = 32; // Ticks to keep in history. | ||
var history = Array(historyLength); | ||
var dir = 'down'; // 'up' or 'down' | ||
var e = void 0; // last scroll event | ||
@@ -79,2 +80,3 @@ var pivot = void 0; // "high-water mark" | ||
attribute = opts && opts.attribute || defaults.attribute; | ||
dir = opts && opts.direction || defaults.dir; | ||
@@ -81,0 +83,0 @@ // If opts.off, turn it off |
/** | ||
* scrolldir - Vertical scroll direction in CSS | ||
* @version v1.2.13 | ||
* @version v1.2.15 | ||
* @link https://github.com/dollarshaveclub/scrolldir.git | ||
@@ -8,2 +8,2 @@ * @author Patrick Fisher <patrick@pwfisher.com> | ||
**/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e():"function"==typeof define&&define.amd?define(e):e()}(0,function(){"use strict";function t(){var t=o.scrollY||o.pageYOffset,e=l.timeStamp,n="down"===c?Math.max:Math.min,p=f.offsetHeight-o.innerHeight;if(t=Math.max(0,t),t=Math.min(p,t),s.unshift({y:t,t:e}),s.pop(),t===n(m,t))return v=e,void(m=t);var b=e-a;if(b>v){m=t;for(var w=0;w<d&&(s[w]&&!(s[w].t<b));w+=1)m=n(m,s[w].y)}Math.abs(t-m)>u&&(m=t,v=e,c="down"===c?"up":"down",i.setAttribute(r,c))}function e(e){return l=e,o.requestAnimationFrame(t)}var n={el:document.documentElement,win:window,attribute:"data-scrolldir"},i=void 0,o=void 0,r=void 0,f=document.body,d=32,a=512,u=64,s=Array(d),c="down",l=void 0,m=void 0,v=0;!function(t){i=t&&t.el||n.el,o=t&&t.win||n.win,r=t&&t.attribute||n.attribute,t&&!0===t.off?(i.setAttribute(r,"off"),o.removeEventListener("scroll",e)):(m=o.scrollY||o.pageYOffset,i.setAttribute(r,c),o.addEventListener("scroll",e))}()}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e():"function"==typeof define&&define.amd?define(e):e()}(0,function(){"use strict";function t(){var t=o.scrollY||o.pageYOffset,e=l.timeStamp,i="down"===d?Math.max:Math.min,p=f.offsetHeight-o.innerHeight;if(t=Math.max(0,t),t=Math.min(p,t),c.unshift({y:t,t:e}),c.pop(),t===i(m,t))return v=e,void(m=t);var b=e-u;if(b>v){m=t;for(var w=0;w<a&&(c[w]&&!(c[w].t<b));w+=1)m=i(m,c[w].y)}Math.abs(t-m)>s&&(m=t,v=e,d="down"===d?"up":"down",n.setAttribute(r,d))}function e(e){return l=e,o.requestAnimationFrame(t)}var i={el:document.documentElement,win:window,attribute:"data-scrolldir",dir:"down"},n=void 0,o=void 0,r=void 0,d=void 0,f=document.body,a=32,u=512,s=64,c=Array(a),l=void 0,m=void 0,v=0;!function(t){n=t&&t.el||i.el,o=t&&t.win||i.win,r=t&&t.attribute||i.attribute,d=t&&t.direction||i.dir,t&&!0===t.off?(n.setAttribute(r,"off"),o.removeEventListener("scroll",e)):(m=o.scrollY||o.pageYOffset,n.setAttribute(r,d),o.addEventListener("scroll",e))}()}); |
@@ -10,3 +10,4 @@ (function (global, factory) { | ||
win: window, | ||
attribute: 'data-scrolldir' | ||
attribute: 'data-scrolldir', | ||
dir: 'down' | ||
}; | ||
@@ -16,2 +17,3 @@ var el = void 0; | ||
var attribute = void 0; | ||
var dir = void 0; // 'up' or 'down' | ||
var body = document.body; | ||
@@ -22,3 +24,2 @@ var historyLength = 32; // Ticks to keep in history. | ||
var history = Array(historyLength); | ||
var dir = 'down'; // 'up' or 'down' | ||
var e = void 0; // last scroll event | ||
@@ -79,2 +80,3 @@ var pivot = void 0; // "high-water mark" | ||
attribute = opts && opts.attribute || defaults.attribute; | ||
dir = opts && opts.direction || defaults.dir; | ||
@@ -81,0 +83,0 @@ // If opts.off, turn it off |
/** | ||
* scrolldir - Vertical scroll direction in CSS | ||
* @version v1.2.13 | ||
* @version v1.2.15 | ||
* @link https://github.com/dollarshaveclub/scrolldir.git | ||
@@ -8,2 +8,2 @@ * @author Patrick Fisher <patrick@pwfisher.com> | ||
**/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.scrollDir=e()}(this,function(){"use strict";function t(){var t=o.scrollY||o.pageYOffset,e=c.timeStamp,n="down"===l?Math.max:Math.min,p=d.offsetHeight-o.innerHeight;if(t=Math.max(0,t),t=Math.min(p,t),s.unshift({y:t,t:e}),s.pop(),t===n(m,t))return v=e,void(m=t);var b=e-u;if(b>v){m=t;for(var h=0;h<f&&(s[h]&&!(s[h].t<b));h+=1)m=n(m,s[h].y)}Math.abs(t-m)>a&&(m=t,v=e,l="down"===l?"up":"down",i.setAttribute(r,l))}function e(e){return c=e,o.requestAnimationFrame(t)}var n={el:document.documentElement,win:window,attribute:"data-scrolldir"},i=void 0,o=void 0,r=void 0,d=document.body,f=32,u=512,a=64,s=Array(f),l="down",c=void 0,m=void 0,v=0;return function(t){return i=t&&t.el||n.el,o=t&&t.win||n.win,r=t&&t.attribute||n.attribute,t&&!0===t.off?(i.setAttribute(r,"off"),o.removeEventListener("scroll",e)):(m=o.scrollY||o.pageYOffset,i.setAttribute(r,l),o.addEventListener("scroll",e))}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.scrollDir=e()}(this,function(){"use strict";function t(){var t=o.scrollY||o.pageYOffset,e=l.timeStamp,i="down"===d?Math.max:Math.min,p=f.offsetHeight-o.innerHeight;if(t=Math.max(0,t),t=Math.min(p,t),c.unshift({y:t,t:e}),c.pop(),t===i(m,t))return v=e,void(m=t);var b=e-a;if(b>v){m=t;for(var h=0;h<u&&(c[h]&&!(c[h].t<b));h+=1)m=i(m,c[h].y)}Math.abs(t-m)>s&&(m=t,v=e,d="down"===d?"up":"down",n.setAttribute(r,d))}function e(e){return l=e,o.requestAnimationFrame(t)}var i={el:document.documentElement,win:window,attribute:"data-scrolldir",dir:"down"},n=void 0,o=void 0,r=void 0,d=void 0,f=document.body,u=32,a=512,s=64,c=Array(u),l=void 0,m=void 0,v=0;return function(t){return n=t&&t.el||i.el,o=t&&t.win||i.win,r=t&&t.attribute||i.attribute,d=t&&t.direction||i.dir,t&&!0===t.off?(n.setAttribute(r,"off"),o.removeEventListener("scroll",e)):(m=o.scrollY||o.pageYOffset,n.setAttribute(r,d),o.addEventListener("scroll",e))}}); |
{ | ||
"name": "scrolldir", | ||
"version": "1.2.13", | ||
"version": "1.2.15", | ||
"description": "Vertical scroll direction in CSS", | ||
@@ -41,3 +41,3 @@ "main": "dist/scrolldir.min.js", | ||
"node-qunit-phantomjs": "^1.4.0", | ||
"rollup": "^0.45.2", | ||
"rollup": "^0.48.0", | ||
"rollup-plugin-babel": "^3.0.0", | ||
@@ -44,0 +44,0 @@ "rollup-plugin-commonjs": "^8.0.2", |
@@ -115,2 +115,7 @@ <figure align="center"> | ||
To turn provide a different scroll direction on page load (or app start): | ||
```javascript | ||
scrollDir({ direction: 'up' }); // the default is 'down' | ||
``` | ||
## Example 🌴 | ||
@@ -117,0 +122,0 @@ |
@@ -5,2 +5,3 @@ const defaults = { | ||
attribute: 'data-scrolldir', | ||
dir: 'down', | ||
}; | ||
@@ -10,2 +11,3 @@ let el; | ||
let attribute; | ||
let dir; // 'up' or 'down' | ||
const body = document.body; | ||
@@ -16,3 +18,2 @@ const historyLength = 32; // Ticks to keep in history. | ||
const history = Array(historyLength); | ||
let dir = 'down'; // 'up' or 'down' | ||
let e; // last scroll event | ||
@@ -73,2 +74,3 @@ let pivot; // "high-water mark" | ||
attribute = (opts && opts.attribute) || defaults.attribute; | ||
dir = (opts && opts.direction) || defaults.dir; | ||
@@ -75,0 +77,0 @@ // If opts.off, turn it off |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
272720
26
4703
125
1