javascript scroll scrollable div code example
Example: scroll to element in scrollable div
function scrollInDiv($scrollableDiv, $scrollTo, animate = true) {
var scrollTo =
$scrollTo.offset().top +
$scrollableDiv.scrollTop() -
$scrollableDiv.offset().top;
if (animate)
$scrollableDiv.animate({
scrollTop: scrollTo,
});
else $scrollableDiv.scrollTop(scrollTo);
}