Comparing version 1.1.6 to 1.1.7
@@ -81,13 +81,4 @@ (function (global, factory) { | ||
var plugin = window.$ || window.jQuery || window.Zepto; | ||
if (plugin) { | ||
plugin.fn.extend({ | ||
scrollDir: function scrollDirFunc(o) { | ||
return scrollDir(o); | ||
} | ||
}); | ||
} | ||
return scrollDir; | ||
}))); |
/** | ||
* scrolldir - Prefectly track user scroll direction without the jitter | ||
* @version v0.0.4 | ||
* scrolldir - Vertical scroll direction in CSS | ||
* @version v1.1.6 | ||
* @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(t){var e={el:document.documentElement,win:window,attribute:"data-scrolldir"},n=t&&t.el||e.el,i=t&&t.win||e.win,o=t&&t.attribute||e.attribute;if(t&&t.off===!0)return n.setAttribute(o,"off");var r=document.body,u=32,d=512,f=64,a=Array(u),s="down",c=void 0,l=void 0,m=0,w=function(){var t=i.scrollY,e=c.timeStamp,w="down"===s?Math.max:Math.min,p=r.offsetHeight-i.innerHeight;if(t=Math.max(0,t),t=Math.min(p,t),a.unshift({y:t,t:e}),a.pop(),t===w(l,t))return m=e,void(l=t);var v=e-d;if(v>m){l=t;for(var b=0;b<u&&(a[b]&&!(a[b].t<v));b+=1)l=w(l,a[b].y)}Math.abs(t-l)>f&&(l=t,m=e,s="down"===s?"up":"down",n.setAttribute(o,s))},p=function(t){c=t,i.requestAnimationFrame(w)};return l=i.scrollY,n.setAttribute(o,s),i.addEventListener("scroll",p)}var e=window.$||window.jQuery||window.Zepto;return e&&e.fn.extend({scrollDir:function(e){return t(e)}}),t}); | ||
!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(t){var e={el:document.documentElement,win:window,attribute:"data-scrolldir"},n=t&&t.el||e.el,i=t&&t.win||e.win,o=t&&t.attribute||e.attribute;if(t&&t.off===!0)return n.setAttribute(o,"off");var r=document.body,u=32,a=512,d=64,f=Array(u),s="down",c=void 0,l=void 0,m=0,b=function(){var t=i.scrollY,e=c.timeStamp,b="down"===s?Math.max:Math.min,h=r.offsetHeight-i.innerHeight;if(t=Math.max(0,t),t=Math.min(h,t),f.unshift({y:t,t:e}),f.pop(),t===b(l,t))return m=e,void(l=t);var p=e-a;if(p>m){l=t;for(var v=0;v<u&&(f[v]&&!(f[v].t<p));v+=1)l=b(l,f[v].y)}Math.abs(t-l)>d&&(l=t,m=e,s="down"===s?"up":"down",n.setAttribute(o,s))},h=function(t){c=t,i.requestAnimationFrame(b)};return l=i.scrollY,n.setAttribute(o,s),i.addEventListener("scroll",h)}return t}); |
{ | ||
"name": "scrolldir", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "Vertical scroll direction in CSS", | ||
@@ -5,0 +5,0 @@ "main": "dist/scrolldir.min.js", |
@@ -68,6 +68,9 @@ <figure align="center"> | ||
```javascript | ||
scrollDir(); | ||
``` | ||
or | ||
```javascript | ||
scrollDir(); | ||
``` | ||
By default, ScrollDir will set the `data-scrolldir` attribute on the `<html>` element to `up` or `down`: | ||
@@ -95,3 +98,7 @@ | ||
``` | ||
or | ||
```javascript | ||
``` | ||
To add the Scrolldir attribute to a different element: | ||
@@ -111,2 +118,2 @@ ```javascript | ||
This is a modular version of [pwfisher](https://github.com/pwfisher)'s [scroll-intent](https://github.com/pwfisher/scroll-intent.js). ~TY! | ||
This is a modular version of [pwfisher](https://github.com/pwfisher)'s [scroll-intent](https://github.com/pwfisher/scroll-intent.js). If you'd like to easily use scrolldir with jQuery—use Scroll Intent. ~TY! |
@@ -74,10 +74,1 @@ export default function scrollDir(opts) { | ||
} | ||
const plugin = window.$ || window.jQuery || window.Zepto; | ||
if (plugin) { | ||
plugin.fn.extend({ | ||
scrollDir: function scrollDirFunc(o) { | ||
return scrollDir(o); | ||
}, | ||
}); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
117
0
117354
255