On my wordpress site, I have created an button that, upon clicking it, will send you to a specific scroll position on the website. This is working great. My issue is getting this code to run once the web page has finished loading. Specifically to scroll to a position on the page that will hide the page header unless the user scrolls back to the top.
This is the JavaScript I've been attempting to use:
<body onLoad="pageScroll(240)">
For reference, this is the HTML of the button I've created:
<button onclick="document.documentElement.scrollTop = 240;document.body.scrollTop =240;">
Click to scroll to beginning of content
</button>
</div>
Here is the entire contents of the header.php file:
I used pastebin because I couldn't figuire how to format the code properly