Giter VIP home page Giter VIP logo

react-scrollspy-ez's Introduction

react-scrollspy-ez

simple scrollspy component for react

NPM JavaScript Style Guide

Demo

here

Install

npm install --save react-scrollspy-ez

Usage

import * as React from "react";

import Scrollspy from "react-scrollspy-ez";

class Example extends React.Component {
  render() {
    return <Scrollspy ids={["one", "two"]} />;
  }
}

Options

  • ids - dom id of the page element to track
  • offset - scroll offset (in pixels), if your page elements have lots of padding. Default is 2.
  • itemContainerClassName - class for the whole scrollspy menu
  • activeItemClassName - class for the active menu item
  • containerElement - a JSX element for the whole menu (default is ul)
  • itemElement - a JSX element for each menu item, default is li

License

MIT ยฉ telega

react-scrollspy-ez's People

Contributors

telega avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-scrollspy-ez's Issues

How I can add class to each header (<li>)?

Hi @telega

I want to display the index content of the document and my index content contains nested headings but as per plugins headers constructed at the same level.
For example:
This is my index:

1. Heading1
    1.1 sub-heading-1
    1.2 sub-heading-2
2. Heading2
3. Heading3

Our plugin generated HTML for the above index as follows:

<ul>
     <li>1. Heading1</li>
     <li>1.1 sub-heading-1</li>
     <li>1.1 sub-heading-1</li>
     <li>2. Heading2</li>
     <li>3. Heading3</li>
</ul>

So here, all sub-heading created at the same level where the main heading belongs. therefor I am unable to add specific styling to sub-heading in order to add padding-left to sub-heading element. Is there any way to add class to each <li> element?
Currently, it is displaying in the following format:

1. Heading1
1.1 sub-heading-1
1.2 sub-heading-2
2. Heading2
3. Heading3

BTW, nice plugin ๐Ÿ‘ it's so easy to add doc section in any app with help of this plugin.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.