I have a lazy-loading list with a function scrollEvent.
window.addEventListener(“scroll”, this.scrollEvent);
When I scroll down, the scrollEvent will load more items.
I just wanna remain the position when I return to this list from a preview page.
I saved the position when I leave the list.
this.scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
when I return to this list, I use:
document.documentElement.scrollTop = “the saved postion.”
In firefox and safari, it only executes the scrollEvent twice. It can’t reach to “the saved postion.”.
But In chrome and edge, it works greatly. it executes the scrollEvent again and again until it reach the correct position.
Any suggestion?