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

Update href when in view #11

Open
mebibou opened this issue Sep 20, 2018 · 2 comments
Open

Update href when in view #11

mebibou opened this issue Sep 20, 2018 · 2 comments

Comments

@mebibou
Copy link

mebibou commented Sep 20, 2018

The elements do get the active class when they are in view, but the href of the url is not updated. Would it be possible to add this as an option?

@edoparearyee
Copy link

@mebibou thanks for feedback, that would be a nice feature. Will try to take a look at it when I get a chance.

@mebibou
Copy link
Author

mebibou commented Nov 27, 2018

FYI to activate this behaviour I am currently using

<sn-scroll-spy-section for="scrollNav" id="a" snInViewport inViewportChange)="inViewport($event, 'a')"></sn-scroll-spy-section>
<sn-scroll-spy-section for="scrollNav" id="b" snInViewport inViewportChange)="inViewport($event, 'b')"></sn-scroll-spy-section>
class Component {
  constructor(private location: Location) {}
  inViewport(inViewport, id) {
    if (inViewport) {
      this.location.go(`#${id}`);
    }
  }
}

I also configured my RouterModule to useHash: false, not sure if it would work otherwise

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

No branches or pull requests

2 participants