Skip to content

Get information of window scrollbar like current position and direction of last scroll.

Notifications You must be signed in to change notification settings

tauqeernasir/use-scroll-bar

Repository files navigation

use-scroll-bar

Build Status

Get information of window scrollbar like current position and direction of last scroll.

How to use?

import React from 'react'
import { useScrollbar } from 'use-scroll-bar'


function App() {

	const scrollState = useScrollbar({ delay: 200 })

	retrun (
		<div>
			User has scrolled {scrollState.directionX}
		</div>
	)
}

What this hook return?

{
	directionX: 'left' || 'right',
	directionY: 'up' || 'down',
	scrollX: number,
	scrollY: number
}

About

Get information of window scrollbar like current position and direction of last scroll.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •