New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

scroll-watcher

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-watcher - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

.travis.yml

38

package.json
{
"name": "scroll-watcher",
"version": "0.1.0",
"description": "A (yet another) cross-browser, event-based, scroll watcher.",
"version": "0.2.0",
"description": "A lightweight, blazing fast, rAF based, scroll watcher.",
"author": "Jonatas Walker",

@@ -10,3 +10,3 @@ "homepage": "https://github.com/jonataswalker/scroll-watcher",

"rollup": {
"entry": "src/js/main.js",
"entry": "src/main.js",
"dest": "build/scroll-watcher.js",

@@ -23,22 +23,32 @@ "moduleName": "ScrollWatcher"

"devDependencies": {
"autoprefixer": "^6.4.1",
"clean-css": "^3.4.19",
"eslint": "^3.5.0",
"eslint-config-jwalker": "^1.9.0",
"node-sass": "^3.9.3",
"node-sass-json-importer": "^2.1.1",
"casperjs": "^1.1.3",
"eslint": "^3.6.0",
"eslint-config-jwalker": "^1.10.0",
"nodemon": "^1.10.2",
"parallelshell": "^2.0.0",
"postcss-cli": "^2.6.0",
"rollup": "^0.35.7",
"rollup-plugin-buble": "^0.13.0",
"rollup": "^0.36.0",
"rollup-plugin-buble": "^0.14.0",
"rollup-plugin-commonjs": "^5.0.4",
"rollup-plugin-json": "^2.0.2",
"rollup-plugin-node-resolve": "^2.0.0",
"uglify-js": "^2.7.3"
},
"eslintConfig": {
"extends": "jwalker"
"extends": "jwalker",
"rules": {
"no-console": 0,
"no-use-before-define": 1,
"vars-on-top": 0
},
"globals": {
"casper": true,
"patchRequire": true,
"phantom": true
}
},
"scripts": {
"test": "make test"
},
"dependencies": {
"tiny-emitter": "^1.1.0"
}
}
# scroll-watcher
A (yet another) cross-browser, event-based, scroll watcher.
A lightweight, blazing fast, [rAF](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) based, scroll watcher.
A more up-to-date approach to this **_scrolling watchers_** stuff. Slightly inspired by [scrollMonitor](https://github.com/stutrek/scrollMonitor).
### Demos
→ [Scrolling, Moving and Recalculating](https://jonataswalker.github.io/scroll-watcher/examples/example.html)
→ [Static Website Menu](https://jonataswalker.github.io/scroll-watcher/examples/example2.html)
## How to use it?
##### → CDN Hosted - [jsDelivr](http://www.jsdelivr.com/projects/scroll-watcher)
```HTML
<script src="//cdn.jsdelivr.net/scroll-watcher/latest/scroll-watcher.min.js"></script>
```
##### &#8594; Self hosted
Download [latest release](https://github.com/jonataswalker/scroll-watcher/releases/latest).
##### &#8594; [NPM](https://www.npmjs.com/package/scroll-watcher)
```
npm install scroll-watcher
```
##### Instantiate and watch for a specific (or a list) DOM element
```javascript
var scroll = new ScrollWatcher();
scroll.watch('my-element')
.on('enter', function (evt) {
console.log('I'm partially inside viewport');
})
.on('exit', function (evt) {
console.log('I'm out of viewport');
})
.on('enter:full', function (evt) {
console.log('I'm entirely within the viewport');
})
.on('exit:partial', function (evt) {
console.log('I'm partially out of viewport');
});
```
## Events `on/once/off`
You can simply watch for scrolling action:
```javascript
var watcher = new ScrollWatcher();
watcher.on('scrolling', function(evt) {
console.log(evt);
});
// or just once
watcher.once('scrolling', function(evt) {
console.log(evt);
});
// and turn it off (later)
watcher.off('scrolling');
```
## Credits
Thanks to [@scottcorgan](https://github.com/scottcorgan) for his great [tiny-emitter](https://github.com/scottcorgan/tiny-emitter).
## License
[Unlicense](https://github.com/jonataswalker/scroll-watcher/blob/master/LICENSE)
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