Skip to content

Commit 68479c7

Browse files
committed
👌 IMPROVE: readme, add banner
1 parent 10464b2 commit 68479c7

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

README.md

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<div align="center">
22

3+
![ScrollSpy Demo](./demo-app/assets/banner.png)
4+
35
# React UI ScrollSpy
46

57
[![npm](https://img.shields.io/npm/v/react-ui-scrollspy.svg)](https://npmjs.com/package/react-ui-scrollspy)
@@ -11,12 +13,10 @@
1113
![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
1214
![NPM](https://img.shields.io/badge/npm-CB3837?style=for-the-badge&logo=npm&logoColor=white)
1315

14-
</div>
15-
16-
Customizable and Simple `ScrollSpy` component for `react` with `TypeScript` support.
17-
1816
Make sure you ⭐️ this [`repository`](https://github.com/pettiboy/react-ui-scrollspy) if you find it helpful or interesting :)
1917

18+
</div>
19+
2020
## ✨ Installation
2121

2222
```bash
@@ -79,7 +79,25 @@ import ScrollSpy from "react-ui-scrollspy";
7979
}
8080
```
8181

82-
`NOTE:` See [`demo-app`](./demo-app/src/App.tsx) for example used [here](https://pettiboy.github.io/react-ui-scrollspy).
82+
## 📝 Notes
83+
84+
Incase the ScrollSpy is not working the way you expected, you can try the following:
85+
86+
- Reduce the value of [`scrollThrottle`](#-throttle).
87+
88+
- If your page contains a `navbar` a `header` consider adding the following `CSS`
89+
90+
```css
91+
html {
92+
scroll-padding-top: 120px; /* height of your navbar */
93+
}
94+
```
95+
96+
- Try using [`offsets`](#-offsets).
97+
98+
- Go through the [`Props`](#-props).
99+
100+
- See [`demo-app`](./demo-app/src/App.tsx) for example used [here](https://pettiboy.github.io/react-ui-scrollspy).
83101

84102
## 💡 Props
85103

@@ -117,11 +135,13 @@ import ScrollSpy from "react-ui-scrollspy";
117135

118136
### 🔧 Customize Attributes
119137

120-
| Attributes | Type | Description | Default | Required |
121-
| :----------------- | :-------- | :------------------------------------------------------------------------------------------------------- | :-------------------- | :------- |
122-
| `useDataAttribute` | `string` | To customize the string after `data-` | `"to-scrollspy-id"` | no |
123-
| `activeClass` | `string` | To customize the `class` added when the `Element` in view | `"active-scroll-spy"` | no |
124-
| `useBoxMethod` | `boolean` | Set to `false` if you want your spy to be active only if more than`50%` of that `div` is in the viewport | `true` | no |
138+
| Attributes | Type | Description | Default | Required |
139+
| :----------------- | :-------- | :-------------------------------------------------------------------------------------------------------- | :-------------------- | :------- |
140+
| `useDataAttribute` | `string` | To customize the string after `data-` | `"to-scrollspy-id"` | no |
141+
| `activeClass` | `string` | To customize the `class` added when the `Element` in view | `"active-scroll-spy"` | no |
142+
| `useBoxMethod` | `boolean` | Set to `false` if you want your spy to be active only if more than `50%` of that `div` is in the viewport | `true` | no |
143+
144+
##
125145

126146
## 📝 Authors
127147

demo-app/assets/banner.png

53.8 KB
Loading

0 commit comments

Comments
 (0)