https://github.com/estrattonbailey/srraf
Monitor scrolling and resizing without event listeners.
https://github.com/estrattonbailey/srraf
resize scroll scrolling
Last synced: over 1 year ago
JSON representation
Monitor scrolling and resizing without event listeners.
- Host: GitHub
- URL: https://github.com/estrattonbailey/srraf
- Owner: estrattonbailey
- Created: 2017-01-25T16:04:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T15:15:46.000Z (over 3 years ago)
- Last Synced: 2025-03-15T23:15:44.327Z (over 1 year ago)
- Topics: resize, scroll, scrolling
- Language: JavaScript
- Homepage:
- Size: 1020 KB
- Stars: 30
- Watchers: 2
- Forks: 2
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# srraf
Monitor scrolling and resizing without event listeners. **300 bytes gzipped.**
## Install
```bash
npm i srraf --save
```
# Usage
```javascript
import srraf from 'srraf'
const scroller = srraf(({ x, px, y, py, vh, pvh, vw, pvw }, timestamp) => {
// ...
})
scroller.update() // check position
scroller.destroy() // destroy listener
```
Note: values prefixed with `p` denote *previous* values.
## License
MIT License © [Eric Bailey](https://estrattonbailey.com)