I have two functions, one which scrolls to the bottom of my page and another which scrolls back to the top.
I'm looking to add another function which scrolls to a specific div which is almost at the bottom of my page. I have included my two functioning scroll functions below and also my third attempt which doesn't work properly. It scrolls to the bottom of my page and then jumps up to the div.
//works
$('.btn1').click(function(){
$('html, body').animate({scrollTop:0}, 750);
});
//works
$('.btn2').click(function(){
$('html, body').animate({scrollTop:$(document).height()}, 750);
return false;
});
//doesn't work
$('.btn3').click(function(){
$('html, body').animate({scrollTop:$(".myDiv").offset().top}, 750);
return false;
});
Any advice or suggestions would be greatly appreciated!