Skip to content

Commit a89ce6e

Browse files
committed
Update readme
1 parent 628b33b commit a89ce6e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ import { NavHashLink as NavLink } from 'react-router-hash-link';
3939
>Link to Hash Fragment</NavLink>
4040
```
4141

42-
### Scrolling API
43-
#### `smooth: boolean`
42+
## Scrolling API
43+
### `smooth: boolean`
4444
- Smooth scroll to the element
4545
- React Router Hash Link uses the native Element method `element.scrollIntoView()` for scrolling, and when the `smooth` prop is present it will call it with the smooth option, `element.scrollIntoView({ behavior: 'smooth' })`
4646
- Note that not all browsers have implemented options for `scrollIntoView` - see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) and [Can I Use](https://caniuse.com/#feat=scrollintoview) - there is also a browser [polyfill for smooth scrolling](https://github.com/iamdustan/smoothscroll) which you can install separately so `smooth` will work in all browsers
@@ -49,7 +49,7 @@ import { HashLink as Link } from 'react-router-hash-link';
4949
<Link smooth to="/path#hash">Link to Hash Fragment</Link>
5050
```
5151

52-
#### `scroll: function`
52+
### `scroll: function`
5353
- Custom scroll function called with the element to scroll to, e.g. `const myScrollFn = element => {...}`
5454
- This allows you to do things like scroll with offset, use a specific smooth scrolling library, or pass in your own options to `scrollIntoView`
5555
```js

0 commit comments

Comments
 (0)