I am trying to implement a feature where the page will automatically scroll to a button that is positioned around 300px from the bottom of the page.
https://i.sstatic.net/XN0yL.png
Whenever this particular button is clicked, I want the body of the page to scroll either up or down in order to keep the button always at the bottom of the screen.
I'm struggling with using the common jquery animate
function for my specific case:
$(".hamburger").click( function(event) {
$('html, body').animate({
scrollTop: $(document).height() - x //need help here
}, 400);
});
});
Any guidance on how to achieve this would be greatly appreciated.