Socket
Socket
Sign inDemoInstall

react-scroll-ondrag

Package Overview
Dependencies
4
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-scroll-ondrag

React library for scrolling elements by dragging the mouse


Version published
Weekly downloads
598
decreased by-52.35%
Maintainers
1
Install size
26.8 kB
Created
Weekly downloads
 

Readme

Source

react-scroll-ondrag

Travis npm package Coverage Status Dependency Status devDependency Status

Scroll your elements by dragging your mouse

Live demo

You can see the simplest demo here: Live demo

Install

$ npm install --save react-scroll-ondrag

Examples

Run examples:

$ cd examples
$ npm install
$ npm start

Usage

import React, { useRef } from 'react';
import useScrollOnDrag from 'react-scroll-ondrag';

const App = () => {
  const ref = useRef();
  const { events } = useScrollOnDrag(ref);

  return <div {...events} ref={ref} />;
};

Arguments

ref

Type: a React ref, required

A ref to the DOM element whose scroll position you want to control

Return value

Type: object, shape: { events: { onMouseDown } }

An object with the events to inject to the controlled element.

License

See the LICENSE file for license rights and limitations (MIT).

Keywords

FAQs

Last updated on 16 Jul 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc