some-react-components / react-scrollchor

A React component for scroll to `#hash` links with smooth animations
ISC License
149 stars 24 forks source link

can url add hash? #13

Closed jnotnull closed 7 years ago

jnotnull commented 7 years ago

First, this rep is very good.

when i click the Anchor, it scrolls very smooth. but can url add hash? because i want to go back by the back button of browser.

bySabi commented 7 years ago

Go back to previous anchor position or to a different url page?

Right know react-scrollchor prevent update of window.location.hash use for browser history (Back and Forward buttons). You can track it yourself using react-scrollchor afterAnimate callback. I'm working a major update with some improvements.

Maybe I'm don't understand your question very well but to put a different url in the anchor you will need React Router to handle it.

bySabi commented 7 years ago

new release, 4.0.0, add window.location.hash tracking that enable back/forward button and browser history.

I'll close issue by now. Reopen is you needed it

seb-thomas commented 6 years ago

@bySabi Is it possible to optionally disable this? I don't want scrolling behaviour in the browser history.

bySabi commented 6 years ago

@plonko I add disableHistory prop to new release, 4.1.0, default is false.

This are the current props https://github.com/bySabi/react-scrollchor#prop-types