I have this JS to scroll to a specific place on pageload (which, for Rails with Turbolinks, is on Turbolinks load):
document.addEventListener("turbolinks:load", function() {
window.scrollTo(240,1);
});
But when I load a page, it loads at 240,1
for a split second, and then jerks back to 0,0
.
Does anyone have an idea what is causing this delayed scroll to 0,0
?
I have also tried replacing "turbolinks:load"
with "page:load"
and "ready"
, they don't work either.
Things that might be relevant:
Try history.scrollRestoration = 'manual';
. It should prevent the page from scrolling back to a previous position.