• This repository has been archived on 07/Aug/2021
  • Stars
    star
    426
  • Rank 101,256 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🔯 react scrollspy component

DEPRECATED - no longer actively maintained.

Please use GhostUI instead.

react-scrollspy

npm version travis dependencies DevDependencies License downloads

Scrollspy component

Demo

Install

$ npm i react-scrollspy

Usage

import Scrollspy from 'react-scrollspy'

...

<div>

  <div>
    <section id="section-1">section 1</section>
    <section id="section-2">section 2</section>
    <section id="section-3">section 3</section>
  </div>

  <Scrollspy items={ ['section-1', 'section-2', 'section-3'] } currentClassName="is-current">
    <li><a href="#section-1">section 1</a></li>
    <li><a href="#section-2">section 2</a></li>
    <li><a href="#section-3">section 3</a></li>
  </Scrollspy>

</div>

Props

items={ Array }

Id list of target contents.

currentClassName={ String }

Class name that apply to the navigation element paired with the content element in viewport.

scrolledPastClassName={ String }

Class name that apply to the navigation elements that have been scrolled past [optional].

componentTag={ String | React element type }

HTML tag or React Component type for Scrollspy component if you want to use something other than ul [optional].

style={ Object }

Style attribute to be passed to the generated <ul/> element [optional].

offset={ Number }

Offset value that adjusts to determine the elements are in the viewport [optional].

rootEl={ String }

Name of the element of scrollable container that can be used with querySelector [optional].

onUpdate={ Function }

Function to be executed when the active item has been updated [optional].

Methods

offEvent

Remove event listener of scrollspy.

onEvent

Add event listener of scrollspy.

Development

$ git clone https://github.com/makotot/react-scrollspy.git
$ cd react-scrollspy
$ npm i
$ npm run start

Contributing

Pull requests and reporting an issue are always welcome :)

License

MIT

More Repositories

1

sidebar

sidebar
CSS
94
star
2

GhostUI

Headless UI copmonent collection for React
TypeScript
52
star
3

scrollspy

scrollspy
JavaScript
41
star
4

react-reading-progress

🔯 react reading progress bar component
JavaScript
25
star
5

eslint-rules-example

eslint rules example
JavaScript
25
star
6

paginated

⚛️ React render props component & custom hook for pagination.
TypeScript
20
star
7

depen

📦 Get the infomation of dependencies in the project.
JavaScript
9
star
8

try-jxa

JXA
AppleScript
8
star
9

postcss-line-height-px-to-unitless

Postcss plugin to convert a line-height value with px to a unitless value.
JavaScript
5
star
10

scss-lint-example

scss-lint
CSS
4
star
11

enabled-update-if

🔯 Skip unnecessary rerendering with render props.
JavaScript
3
star
12

angular-refresher

JavaScript
3
star
13

css-layouts

A curated list for CSS layout
2
star
14

react-is-online

WIP 🚧
JavaScript
2
star
15

static-indexer

JavaScript
1
star
16

construct

Yet another CSS framework that follows ITCSS and BEM (BEMIT)
HTML
1
star
17

playground

🎮 playground
Ruby
1
star
18

jqzoom

JavaScript
1
star
19

assemble-sandbox

sandbox
JavaScript
1
star
20

browserify-sample

http://makotot.github.io/browserify-sample
JavaScript
1
star
21

zenn-content

1
star
22

css-tooling

css tooling
1
star
23

try-cypress

JavaScript
1
star
24

jshint-table-reporter

JSHint table reporter.
JavaScript
1
star
25

undecorated

Collection of reusable CSS layout pattern
TypeScript
1
star
26

typesafe-actions-immer-reducer

Created with CodeSandbox
TypeScript
1
star
27

date-range

TypeScript
1
star
28

stylelint-example

stylelint example
CSS
1
star
29

try-es6

JavaScript
1
star
30

sb-addon-coverage-example

TypeScript
1
star
31

re-ducks-gen

JavaScript
1
star
32

assign-function-to-object

Created with CodeSandbox
TypeScript
1
star