Imagine there are two buttons (Button 1 and Button 2) on a webpage (Page A). Clicking on either button will take you to the same external page (Page B). How can we ensure that Button 1 takes you to the top of Page B, while Button 2 automatically scrolls down to a specific section?
Perhaps the code example would resemble something like this:
<div id="b1" class="button"> </div>
<div id="b2" class="button"> </div>
On Page B, you would have a JavaScript function like so:
function initPage() {
if(scrollTo1k == true)
{
body.animate({scrollTop: 1000}, 1000);
}
}
UPDATE: I've managed to make the computer open a new page at the desired location, but unfortunately, there is no scroll effect when the page opens.