Skip to content

Implementation of Scrollspy #32

@markusjwetzel

Description

@markusjwetzel
<Scrollspy.Provider>
  <Nav>
    <Nav.Link toggle={Scrollspy} target="anchor-1">
      Anchor #1
    </Nav.Link>
    <Nav.Link toggle={Scrollspy} target="anchor-2">
      Anchor #2
    </Nav.Link>
  </Nav>
  <View>
    <Scrollspy.Anchor id="anchor-1" />
    <Text>Lorem ipsum...</Text>
    <Scrollspy.Anchor id="anchor-2">
      <Heading>Anchor #2</Heading>
    </Scrollspy.Anchor>
    <Text>Lorem ipsum...</Text>
  </View>
</Scrollspy.Provider>

All anchor refs can be stored by id on mounting. On Nav.Link click we need to scroll to the position of the anchor ref. Also we need to track the current active anchor and add active class to the active Nav.Link accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions