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

react-simple-scroll-container

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-simple-scroll-container

A simple scroll container for React.

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

react-simple-scroll-container

A simple scrolling container for react.

npm package v David Dependancy Status npm package dm

Table of Contents

  • API
    • ScrollSection
    • ScrollTo
    • ScrollContainer
  • Examples

Api

ScrollContainer
PropTypeWhat does it do
ContainerIdStringThe id of the container to use for navigation.
ExtraStyleObjectInline css object to be added to the container div.
ExtraClassStringExtra classname(s) to be added to the container div.
TopScrollBoolShould container detect the currently active top element.
TopScrollCallbackFuncCallback which provides the new active element.
TopScrollOffsetNumberThis is a small offset for the active scrolling detection, default is 10 pixels.
ScrollTo
PropTypeWhat does it do
SectionIdStringThe id of the section to navigate to.
ContainerIdStringThe id of the container the element is in.
DurationIntegerThe time it will take the scroll to complete the distance in ms.
OffsetIntegerThe amount to offset the scrolling to ( 10 means it will scroll 10 pixels higher.)
ScrollSection
PropTypeWhat does it do
ChildrenReact component(s)The children you want to be scrollable.
SectionIdStringThe section id you will use to scroll to.

Examples

Basic usage of the container and sections

Using the containerId ensures you call a unique element in that specific container.

<ScrollContainer id="newContainer">
     <ScrollSection id="section1">
        <somecomponent />
     </ScrollSection>
     ....
</ScrollContainer>
Scroll to a section
<div onClick={() => ScrollTo('targetId','newContainer', 10, 500)}>
	Click me to navigate to section #1
</div>

Keywords

FAQs

Package last updated on 29 May 2018

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