Real noob. How do I make it autoscroll to a part on the page?

Sooo. As the title says. #RealNoob here. lolz. Any help or kindness is greatly appreciated!! Okay so there’s a few things I’m trying to do here but the more I try it starts telling me “Wixapp is not defined” like what? Why did it tell me to use it in the guide then? Pssht.
OK. I’ve enabled the Dev kit on my computer Wix Editor X app, here. And Now I need to create 2 things.

  1. A Age Check Verification, nothing fancy just wanna make sure they have read the Terms of Conditions, cookies agreement, privacy agreement if they continue to use the site.

  2. An auto scroll down to the next page break, as soon as the viewer arrives on the Home page and finishes their Age check.
    I haven’t really coded in a good couple years, so any help or explanation is greatly appreciated! Let’s hope we can get this working, Peeps!
    Thank-you for taking time out of your busy day for me!

import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(
wixwindow.scrollTo(300, 500)
); 

this is what I’ve got from different sources and it does NOT work. Please help asap. U are AWESOME!

import wixWindow from ‘wix-window’ ;

// …

wixWindow . scrollTo ( 0 , 630 , { “scrollAnimation” : false });

Got this, now the scrolling seems to be working. Onto the next bit. The Age Verification…

This only partially works. I don’t know how to use the OnReady() thing. Can someone please help me? And I found the Lightboxes. It’s just a matter of seeing where it gets triggered :slight_smile: Please, thank-you.

@kylerhoodicoff The OnReady function is what runs when your page is loaded. So whatever you put in that will be run.

If you have a certain section you want the user to scroll down to once they enter the page, I’d recomend to instead use the scrollTo function to scroll to that, rather than a set pixel height (in case of different screen sizes) You can do that by doing the following:

$w("#SectionName").scrollTo()

put that within the onReady function, and replace SectionName with the name you’ve given the section.

Do you just want to have a Read terms and conditions button?

1 Like