jquery滚动div到指定位置

原文地址:https://www.cnblogs.com/jaxu/archive/2013/05/17/3083019.html

var container = $('div'),
    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/dch0/p/12679557.html