如何做到有滚动条的div,通过jQuery滚动到指定元素的位置

var container = $('div'),
var scrollTo = $('#row_8'); container.scrollTop( scrollTo.offset().top - container.offset().top + container.scrollTop() ); // Or you can animate the scrolling: container.animate({ scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop() });​

猜你喜欢

转载自www.cnblogs.com/wcrBlog/p/10125790.html