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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.1
    412
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.1
    412
  • 2.0.0
    345
  • 1.0.0
    0
  • 0.5.2
    0
  • 0.5.0
    0

Package Sidebar

Install

npm i get-scroll

Weekly Downloads

612

Version

2.0.1

License

MIT

Unpacked Size

3.55 kB

Total Files

6

Last publish

Collaborators

  • fregante