get-scroll

2.0.1 • Public • Published

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

Package Sidebar

Install

npm i get-scroll

Weekly Downloads

628

Version

2.0.1

License

MIT

Unpacked Size

3.55 kB

Total Files

6

Last publish

Collaborators

  • fregante