How to load to the bottom of the page?

Hi all, I’m pretty unexperienced with code but I’m just wondering if its possible to load to the bottom of the page, and have users scroll upwards, would appreciate any help :slight_smile:

Hi @ollydude5

To navigate to the bottom of the page, just scrollTo the footer of the page.

$w('#footer').scrollTo()

That works perfectly in the preview, but when I published it and tested it, it only seemed to work once, despite refreshing the page multiple times. For reference I’m using designing a website for mobile if that clears anything up.

Can you provide a link to the live website so I can test it.

Here you go, https://oliverwalton20.wixsite.com/yuri1
I’m only really looking for mobile functionality here so I don’t think there will be anything there on desktop.

What is triggering the scroll? I can’t find a button or anything similar to it in mobile

I’m not really sure what you mean? I just want it to start at the bottom of the page when you get access to the website, I pasted that line of code into the Page Code tab and that’s as far as I’ve got.

I’ve visited your website and there was an error on the page, make sure that your footer is visible on the page you’re running the code on, and that your footer ID matches the ID included in the code, publish the page, then try again.

Let me know when you’re done so I can test it too.

I’ve unhid everything on the page and changed the ID in the code to footer 1 like this:

$w ( ‘#footer1’ ). scrollTo ()

It still works in the preview however nothing on the published site.

I’ve taken a look at your site and can see that you need to add an onReady.

When working with Velo the code cannot be run by the browser until the site is ready, which is why we wrap it in an onReady.

It might look something like this:

$w.onReady(function () {
    $w('#footer1').scrollTo()
});

This works perfectly thank you!