Here is a method to scroll the DIV's scroll bar to the location of its child elements to facilitate automatic positioning.
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()
});
You don’t need any JQuery plug-in to achieve the desired effect, it’s very easy to use!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn