Move to top of page when scene changes

Hello,

I have some a long page in the first scene - how may i return position to top of page when the scene changes?

Thank you!
Pea

onsceneunload:

element.scrollTop = 0

1 Like

Thank you - apologies for my simple question :grin:

shoot does that go in “Trigger Custom Behavior” ? doesn’t seem to be working :expressionless:

Sorry it’s not text I’m trying to scroll its the whole scene - with images and text boxes etc.

Any ideas are very appreciated thank you!

place it in a "Run Javascript… " -> “New Function” on scene unload.

“element” will point to the entire scene.

Great thank you sir!

hmmm am i missing something here ? thank you for your help!

try

document.body.scrollTop = 0;

This also works:

(There are many ways)

window.scrollTo(0, 0);

Ok that did the trick thank you so much!

Is there any way that it can happen smoothly?

Here’s how to smooth that movement: Scroll smoothly to the bottom of the page

This is not working… I past the lines onto the HEAD but it does not change anything. What would be the solution for, when the scene change, the page goes up smoothly instead of staying at the same place?

Here’s an example of that. On Scene load, I have the scroller animate to the top of the scene. You can see it in action by clicking the right box at the bottom of scene 1:
smoothscrolling-SceneTop.zip (64.3 KB)

For a reason or another, it’s not working… Maybe Chrome?

Here’s my website : www.martineaulachance.com

When you click a word it goes to another scene where I animated the title, from there everything’s cool but for the ones more down, when you click I wish the page to go up with the rest. On small screen the new scene stay at the same position as the HOME scene making the transition kind of awkward. Just look at “COMME ÇA” for example.

I’m trying the code you put but it’s not working.

All good I figured out.