use-window-scroll-position

1.1.1 • Public • Published

use-window-scroll-position

package version package downloads standard-readme compliant package license make a pull request JavaScript Style Guide

React hook to get current scroll position of the window

Table of Contents

Usage

import {useWindowScrollPosition} from 'use-window-scroll-position'

const Nav = () => {
    const position = useWindowScrollPosition() // default config: { wait = 100, passive = true }
    console.log(position) // {x: ..., y: ...}
    return null
}

Install

This project uses node and npm.

$ npm install use-window-scroll-position
$ # OR
$ yarn add use-window-scroll-position

Contribute

  1. Fork it and create your feature branch: git checkout -b my-new-feature
  2. Commit your changes: git commit -am "Add some feature"
  3. Push to the branch: git push origin my-new-feature
  4. Submit a pull request

License

mit

Package Sidebar

Install

npm i use-window-scroll-position

Weekly Downloads

2

Version

1.1.1

License

mit

Unpacked Size

4.88 kB

Total Files

4

Last publish

Collaborators

  • tiaanduplessis