Answers for "scroll to element in scrollable div"

0

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);
}
Posted by: Guest on February-10-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language