Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

autoscroll

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autoscroll

A utility for auto-scroll when almost reach boundary

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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:
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) => {
            // Start auto scrolling
            autoScroll.run(e, this.content);
        },
        onMouseOut: (e) => {
            // Stop auto scrolling if any
            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

Keywords

FAQs

Package last updated on 20 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc