Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrolling does not change the hash of the url #52

Closed
wellfrog16 opened this issue Mar 9, 2019 · 7 comments
Closed

Scrolling does not change the hash of the url #52

wellfrog16 opened this issue Mar 9, 2019 · 7 comments

Comments

@wellfrog16
Copy link

only change the hash by click

@wellfrog16 wellfrog16 changed the title Scrolling does not change the hash of the address Scrolling does not change the hash of the url Mar 9, 2019
@justinriggio
Copy link

@wellfrog16 did you find a workaround for this? Having the same issue.

@Psychokrameur
Copy link

also interested!

@pinkman-frontend-user
Copy link

       scrollactive.nav(
          @itemchanged="onItemChanged"
        )
  methods: {
   onItemChanged(event, item) {
      if (item) {
        history.pushState(null, null, item.href)
      }
    }
}

@axieum
Copy link

axieum commented Jan 16, 2020

Push whitespace to remove the anchor from the url

history.pushState(null, null, item ? item.href : ' ')

Note: this does not preserve page queries (i.e. ?q=query+param)

@axieum
Copy link

axieum commented Jan 16, 2020

I recommend against modifying the history outside of Vue Router as it interferes with the browser's back button and history.

@eddiemf
Copy link
Owner

eddiemf commented May 13, 2020

I'm not sure if it makes sense to have this as a feature. It's how browsers have worked since forever and I think it's almost always not the intended behaviour.

If you really want to have this behaviour for some reason you can always resort to the itemchanged event and implement it yourself as @pinkman-frontend-user mentioned.

@eddiemf eddiemf closed this as completed May 13, 2020
@axieum
Copy link

axieum commented May 14, 2020

I believe the intentions behind this feature is for the URL to reflect the point at which the user has scrolled to. Thereby allowing them to copy the URL at any point. But yes, I do think this is a minor feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants