Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scrolldir

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scrolldir - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

9

dist/scrolldir.js

@@ -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;
})));

6

dist/scrolldir.min.js
/**
* 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc