I am exploring a method to implement the scrollTo() function on a new page after a specific link has been clicked. Unfortunately, utilizing window.onload is not suitable for my scenario as I only want the scrolling action to occur when the page is accessed through a particular link.
My goal is to have the home page redirect and smoothly scroll to the 'other' section of the services page:
HTML:
<a onclick="otherServices">Other Services</a>
JavaScript:
function otherServices() {
window.location = "/services";
win = window.location;
setTimeout(win.scrollTo(0,document.body.scrollHeight), 3000);
}
Ideally, I would like to steer clear of using jQuery if possible.