2.0.1 • Published 4 years ago

get-scroll v2.0.1

Weekly downloads
647
License
MIT
Repository
github
Last release
4 years ago

get-scroll gzipped size npm version

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