Skip to content

Repository files navigation

autoscroll

A utility for auto-scroll when trigger location of event (i.e. mouse event) almost reach boundary.

NPM

Installation

  1. Install the latest version of autoscroll:
 npm install --save autoscroll
  1. At this point you can import autoscroll:
importautoScrollfrom'autoscroll';

Example

importReact,{PureComponent}from'react';importautoScrollfrom'autoscroll';classExampleextendsPureComponent{refContent=(content)=>{this.content=content;}actions={onMouseMove: (e)=>{// Start auto scrollingautoScroll.run(e,this.content);},onMouseOut: (e)=>{// Stop auto scrolling if anyautoScroll.end();}};render(){return(<divstyle={{height: 500,overflow: 'auto'}}ref={this.refContent}onMouseMove={this.actions.onMouseMove}onMouseOut={this.actions.onMouseOut}><divstyle={{height: 1000,backgroundColor: 'yellow'}}/></div>);}}exportdefaultExample;

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages