some-react-components / react-scrollchor

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

location(url) getting changed #38

Closed ShivanshSharma1 closed 3 years ago

ShivanshSharma1 commented 3 years ago

Is there any way to stop it from changing location(url).

bySabi commented 3 years ago

I don't understand what you need. Please explain a little more

ShivanshSharma1 commented 3 years ago

When I click on a ScrollChor element, it takes me to the element with the given id but it also adds #(id) at the end of the url. Is there any way to prevent it from adding the id at the end of the url.

bySabi commented 3 years ago

@ShivanshSharma1 Adding the id at the end of the URL is done by the browser when you click on a <a> element as is this case.

Try the simulateClick API and the childrenless Scrollchor as in this example: https://github.com/some-react-components/react-scrollchor/issues/17

Sorry I can't try it myself because I'm out of time.

Tell me how it went.

bySabi commented 3 years ago

Maybe using disableHistory: true is enough

ShivanshSharma1 commented 3 years ago

It worked, Thanks. Sorry, I missed the props section in the docs

bySabi commented 3 years ago

I glad it worked 👍