Open DavidFrahm opened 7 years ago
Same problem.
I change
private get scrollTop () { return document.body.scrollTop }
private set scrollTop ( number : number ) { document.body.scrollTop = number; }
to
private get scrollTop () { return window.scrollY }
private set scrollTop ( number : number ) { window.scrollTo(0, number) }
It works for me.
I'm trying to use this in my Angular 4.0.1 project, and everything looks great except the scroll position is being stored incorrectly sometimes.
When I route to a page, then use the browser "Back" button (without scrolling or interacting with the page at all), the scroll position is stored as something other than zero.
So then of course the
document.body.scrollTop
doesn't work correctly when I use the browser "Forward" button to return to the page.Happy to share code if it might help, just let me know what would be helpful to see.
Its a very bare app with only two pages of static content right now.