这里有一个方法可以将DIV的滚动条滚动到其子元素所在的位置,方便自动定位。
varcontainer = $('div'),
inner= $('#inner');
container.scrollTop(
inner.offset().top- container.offset().top +container.scrollTop()
);//Or you can animate the scrolling:container.animate({
scrollTop: inner.offset().top- container.offset().top +container.scrollTop()
});