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

Installation
npm install --save autoscroll
- At this point you can import
autoscroll
:
import autoScroll from 'autoscroll';
Example
import React, { PureComponent } from 'react';
import autoScroll from 'autoscroll';
class Example extends PureComponent {
refContent = (content) => {
this.content = content;
}
actions = {
onMouseMove: (e) => {
autoScroll.run(e, this.content);
},
onMouseOut: (e) => {
autoScroll.end();
}
};
render() {
return (
<div
style={{
height: 500,
overflow: 'auto'
}}
ref={this.refContent}
onMouseMove={this.actions.onMouseMove}
onMouseOut={this.actions.onMouseOut}
>
<div
style={{
height: 1000,
backgroundColor: 'yellow'
}}
/>
</div>
);
}
}
export default Example;
License
MIT