Skip to content

Repository files navigation

react-scroll-detector

Travisnpm packageCoveralls

Demo

Local demo:

git clone https://github.com/rechat/react-scroll-detector.git
cd react-scroll-detector
npm i && npm start

Installation

npm i react-scroll-detector --save

Example

importReactfrom'react'importReactScrollDetectorfrom'react-scroll-detector'classAppextendsReact.Component{handleScrollBottom(){console.log('On Scroll Bottom')}handleScrollTop(){console.log('On Scroll Top')}render(){return(<ReactScrollDetectordebounceTime={500}accuracy={90}onScrollBottom={this.handleScrollBottom}onScrollTop={this.handleScrollTop}><divstyle={{minHeight: '500px',maxHeight: '500px',overflow: 'auto'}}>
...
</div></ReactScrollDetector>)}}

API

PropTypeDescriptionDefault
onScrollBottomFunctionTriggers when scroll reaches bottom(top) => {}
onScrollTopFunctionTriggers when scroll reaches top(top) => {}
accuracyNumberAccuracy of detection90
debounceTimeNumberD etection debounce time in milli seconds500

License

MIT

About

React ScrollTop and ScrollBottom Detector

Topics

Resources

Contributing

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages