Answers for "how to make an element scrollable"

15

how to make a div scrollable

<div id="" style="overflow:scroll; height:400px;">
Posted by: Guest on February-15-2020
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 "how to make an element scrollable"

Code answers related to "Javascript"

Browse Popular Code Answers by Language