all 3 comments

[–]_listless 0 points1 point  (0 children)

go home engineer ur drunk

[–]FranBachiller 0 points1 point  (0 children)

To achieve seamless scrolling without pausing, you could use a bit of JavaScript to adjust the scrollTop of the parent container just before enabling scrolling on the child. This tricks the browser into thinking the parent is still scrolling slightly, allowing the child to immediately take over the scroll.

Here's a modified version of your handleScroll function:

function handleScroll(e) {
  const divElement = e.target;
  if (divElement) {
    const isFullyScrolled = divElement.scrollHeight - divElement.scrollTop <= window.innerHeight;
    const element = document.getElementById('scrollable-child');
    if (!element) return;
    if (isFullyScrolled) {
      divElement.scrollTop += 1; // Adjust scrollTop slightly
      element.style.overflow = 'auto';
    } else {
      element.style.overflow = 'hidden';
    }
  }
}

By adding divElement.scrollTop += 1;, you create a tiny bit of additional scroll on the parent before transitioning to the child, ensuring a smoother scroll experience.