Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Don't highlight the first item until the user has reached it #91

Open
@dreamawakening

Description

@dreamawakening

I have the following sections on my page:

  1. intro
  2. skillset
  3. values
  4. showcase
  5. my-story

My navbar has a link for all of these items, except for intro, which I'm not using in this case:

<Scrollspy
  className="navbar-nav ml-auto"
  currentClassName="active"
  items={['skillset', 'values', 'showcase', 'my-story']}
  offset={-100}
>
  Links ...
</Scrollspy>

If the user is inside the intro section, but behind the skillset section, it'll apply the currentClassName to skillset (the first item in items). This shouldn't happen until the user is there.

Adding intro to the ScrollSpy (a link and item to its items prop) fixes this. So as a workaround I've done this but used display: none on it so it doesn't show.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions