8000 GitHub - rommguy/react-custom-scroll at v1.1.0
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rommguy/react-custom-scroll

Repository files navigation

NPM version

React-Custom-Scroll

An easily designable, cross browser (!!), custom scroll with ReactJS
Animations and scroll rate exactly like native scroll

Why do I need this ?

  • Same design on all browsers
  • Scrollbar is above the content instead of floating to the side - same layout on scrolled content as not scrolled content

How to use ?

Custom scroll component is available in commonJS format so you can just require it after installing.
There is also a UMD version - inside dist directory.
In both cases you have to include the customScroll.css file in your page.

wrap your content with the custom scroll component remove overflow style properties from your content root component - The custom scroll will take care of it

<customScroll>
  your content
</customScroll>

Options (react props)

  • allowOuterScroll : boolean, default false. Blocks outer scroll while scrolling the content
  • heightRelativeToParent : string, default undefined. Content height limit is relative to parent - the value should be the height limit.
  • onScroll - function, default undefined. Listener that will be called on each scroll.
  • addScrolledClass - boolean, default false. If true, will add a css class 'content-scrolled' while being scrolled.
  • freezePosition - boolean, default false. When true, will prevent scrolling.
Example for heightRelativeToParent
<customScroll heightRelativeToParent="calc(100% - 20px)">
  your content
</customScroll>  

It doesn't work, please help me

  • Check if you forgot to remove 'overflow' properties from the content root element.
  • Check if your height limit is relative to parent, and you didn't use heightRelativeToParent prop.

About

Easily customize the browser scroll bar with native OS scroll behavior

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 13

0