javascript - Jquery make div always scroll to bottom -
i have div contains table. table dynamically updated, , filling data user using our website. possible force div scrolled bottom? user able see bottom table row added. thank you!
that like
...onrowadded = function() { $('#mytable').animate({scrolltop: $('#mytable').attr('scrollheight')}); }; note, if rows added often, want use settimeout blocking variable check @ beginning prevent scrolling down more twice per second or so. technique discussed e.g. here
update
starting jquery 1.6 better use .prop() instead of .attr() (see comments question):
onrowadded = function() { $('#mytable').animate({scrolltop: $('#mytable').prop('scrollheight')}); };
Comments
Post a Comment