Open mebibou opened 5 years ago
@mebibou thanks for feedback, that would be a nice feature. Will try to take a look at it when I get a chance.
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
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?