Fuxi Fuxi - 4 months ago 25
jQuery Question

How do I scroll a row of a table into view (element.scrollintoView) using jQuery?

I'm dynamically adding rows to a table using jQuery.
The

table
is inside a
div
which has
overflow:auto
thus causing a vertical scrollbar.

I now want to autoscroll my container
div
to the last row. What's the jQuery version of
tr.scrollintoView()
?

Answer
var rowpos = $('#table tr:last').position();

$('#container').scrollTop(rowpos.top);

should do the trick!