1.0.6 • Published 4 years ago

use-scrollock v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

use-scrollock

Locks/ Unlock scroll for <body /> or other component.

NPM JavaScript Style Guide

Install

Using npm:

npm install --save use-scrollock

Using yarn:

yarn add use-scrollock

Usage

import * as React from "react";

import { useClipboard } from "use-scrollock";

const Example = () => {
  const { scrollock, toggleScrollock } = useClipboard();

  return <div style={{ height: "100vh", background: "purple" }}>hello</div>;
};

API

UseScrollockProps(options: UseScrollockProps): UseScrollockReturnType

UseScrollockProps

  • disableHorizontalScroll - Disables horizontal scroll. Defaults to true.
  • disableVerticalScroll - Disables vertical scroll. Defaults to true.
  • padScrollbarSpace - Should the scroll bar space be preserved. Defaults to false.
  • ref - Provide reference to a component other than body.

UseScrollockReturntype

  • scrollock - Incicates the current scrollock state.
  • toggleScrollock(value: boolean) - toggles the scrollock state, you can manually set the value too.

Live Demo

Found this project useful? ❤️

If you found this project useful, then please consider giving it a ⭐️ on Github and sharing it with your friends via social media.

Issues and feedback 💭

If you have any suggestion for including a feature or if something doesn't work, feel free to open a Github issue for us to have a discussion on it.

License

MIT © fayeed


This hook is created using create-react-hook.

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago