Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
toviszsolt committed Mar 28, 2024
1 parent 8ac91de commit c049f63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ yarn add react-scrollspy-navigation

## How to use it

### Step 1: Content

Add a unique `id` to content blocks or heading tags for the elements you want to spy on. There is nothing more to do
with the content elements. It's awfully simple so far, right?

Expand Down Expand Up @@ -64,6 +66,8 @@ conat ContentWithHeaders = () => {
)};
```

### Step 2: Navigation

Wrap your navigation structure with `ScrollSpy` component. Use only `a` tags whose `href` attribute is the hash link of
the `id` of an existing content element. You can use structures of any complexity or depth in the `ScrollSpy` component,
and you can nest multiple `ScrollSpy` components (although this works, it is not recommended). Don't worry, `ScrollSpy`
Expand Down Expand Up @@ -125,7 +129,7 @@ how `ScrollSpy` works.
| threshold | number \| number[] | [0, 0.25, 0.5, 0.75, 1] | Thresholds for the intersection. Element to be observed. See: [IntersectionObserver: IntersectionObserver()](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/IntersectionObserver#options) observer. |
| onClickEach | function | undefined | Callback function for handle the click event |

### Parameters for using the `onClickEach(event, internalClickHandler, container)` function.
### `onClickEach(event, internalClickHandler, container)`

- `event`: The original click event
- `internalClickHandler`: The internal function that scrolls to the element. This should be called at the end of the
Expand Down

0 comments on commit c049f63

Please sign in to comment.