ibufu / vue2-scrollspy

Scrollspy for Vue2
https://ibufu.github.io/vue2-scrollspy/
MIT License
135 stars 32 forks source link

Option to stop clicking on links from updating the hash in the location bar #39

Open PawelDecowski opened 5 years ago

PawelDecowski commented 5 years ago

Describe what you want:

In a project I’m working on, I don’t want the navigation clicks to change the URL. Eg:

URL:

https://example.com/

Navigation link:

<a href="#about">About</a>

After clicking, the viewport is scrolled to the #about anchor but the URL remains https://example.com/ (hash is not updated/added).

It could be an option on v-scroll-spy-link:

<ul v-scroll-spy-link="{updateHash: false}">
devotoare commented 4 years ago

I know it's late but I'm fairly certain you don't even need to put an href, so if you remove it, it should still work.

PawelDecowski commented 4 years ago

@devotoare You’re correct. By removing href the behaviour is as expected. I’m probably missing something but how does it know where to scroll to without the href?

devotoare commented 4 years ago

@PawelDecowski Honestly not sure, haven't looked at the code very closely. Just figured I could answer the basic question since I tried it. Sorry