1function scrollInDiv($scrollableDiv, $scrollTo, animate = true) {
2 var scrollTo =
3 $scrollTo.offset().top +
4 $scrollableDiv.scrollTop() -
5 $scrollableDiv.offset().top;
6 if (animate)
7 $scrollableDiv.animate({
8 scrollTop: scrollTo,
9 });
10 else $scrollableDiv.scrollTop(scrollTo);
11}