How can i auto scroll to bottom of page with jquery becuase i am requesting xmlhttp to update content of page
To cover all scenarios: Consider scrolling an overflowed div where height is not the same as scrollHeight. (remove the animate part if its not needed):
$('#myDiv').animate({
scrollTop: $('#myDiv').get(0).scrollHeight
}, 1500);
This Code work for me:-
jQuery("html, body").animate({ scrollTop: jQuery(window).height()}, 1500);
A lot of the scrollHeight implementations didn't work for me, offsetHeight seemed to do the trick.
Pretty sure that scrollHeight tries to move it to the bottom of the height of the static element, not the height of the scrollable area.
var pane = document.getElementById('pane');
pane.scrollTop = pane.offsetHeight;
auto scroll to bottom of page with jquery (Best):
$(function () {
$("html, body").animate({
scrollTop: $('html, body').get(0).scrollHeight}, 1000);});
Demo
function scroll(){
$('html, body').animate({
scrollTop: $("#footerOfPage").offset().top
}, 0);
}
in my case it's:
myscroll = $('#myDiv');
myscroll.scrollTop(myscroll.get(0).scrollHeight);