Scroll to ID once page has loaded

Good morning, I have spent quite a lot of time researching and testing. However I cannot get this to work and not sure if it is me or how I am putting it into the JS section of the page.

I would like it so when the page has completely loaded it would scroll to the ID ‘SearchOptions’.

My code which I put in the JS section of the page (Pro > Edit Page > click on JS on the left hand side)

$(window).load(function() {
 $('html, body').animate({
    scrollTop: $('#SearchOptions').offset().top}, 1000);
});

What am I doing wrong? Thank you!

Hello @hyperdrive_boom,

Thanks for posting in!

Your javascript is incorrect. Have it updated and use this:

(function($){
  $(window).load(function() {
    $('html, body').animate({
      scrollTop: $('#SearchOptions').offset().top}, 1000);
  });
})(jQuery);

Hope this helps.

Good morning and thank you so much for this - this is perfect!!!

Jason

You’re most welcome, Jason.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.