get-scroll
v2.0.1
Published
Micro module to get the scroll position (top or left) in the browser
Downloads
1,415
Maintainers
Readme
get-scroll
Micro module to get the scroll position (top or left) in the browser
Usage
Directly in the browser
Copy the content of dist/get-scroll.browser.js
into your JS file and then use it this way:
var currentScrollTop = getScrollTop();
var currentScrollLeft = getScrollLeft();
With browserify/webpack
npm install --save get-scroll
var getScroll = require('get-scroll');
var currentScrollTop = getScroll.top(); // or just getScroll()
var currentScrollLeft = getScroll.left();
In ES6
import {getScrollLeft, getScrollTop} from 'get-scroll';
let currentScrollTop = getScrollTop()
let currentScrollLeft = getScrollLeft()
Dependencies
No dependencies.
License
MIT © Federico Brigante