📅  最后修改于: 2022-03-11 15:01:56.812000             🧑  作者: Mango
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);
}