Buttons linking to other scenes (how to anchor to top?)?

anchor

#1

Hey all,

So I have a not-yet-published site I’m making through Hype, so I dont ahve a link, but my question is simple.

I have created some buttons, a makeshift navigation at the bottom of each page/scene… however, whenever you click on any button and venture to a new scene/page, it does not load or anchor to the top, instead it shows the bottom of that page, or the middle.

How can i get any scene/page load to the very top of the page each time?

Thanks!


#2

Run this function ‘On Scene Load’ for every scene:

window.scrollTo(0, 0);

More on the scrollTo function: https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo


#3

Awesome. Thanks so much. Worked perfect. Question, though, why would this be designed not to do this? Just trying to understand the benefit of one scene loading at the same location as the last page, or even below the top. Just curious why this isn’t more of a default and what the upside is for not (maybe I can use that upside).

Thanks!