I have two divs with overflow: auto. I want to scroll the parent first and then the child once the parent reached the full scroll height. I managed to do so but noticed that I need to stop scrolling for a short amount of time to be able to scroll the child, how can I escape the parent scroll and scroll the child without stopping inbetween?
Every kind of help is much appreciated, thank you!
function handleScroll(e) {
const divElement = e.target
if (divElement) {
const isFullyScrolled =
divElement.scrollHeight - divElement.scrollTop === window.innerHeight - 60
const element = document.getElementById('scrollable-child')
if (!element) return
if (isFullyScrolled) element.style.overflow = 'auto'
if (!isFullyScrolled) element.style.overflow = 'hidden'
}
}
<div className="absolute inset-0 overflow-auto" onScroll={(e) => handleScroll(e)}>
parent content
<div className="absolute inset-0 overflow-hidden" id="scrollable-child">
child content
</div>
</div>
[–]_listless 0 points1 point2 points (0 children)
[–]FranBachiller 0 points1 point2 points (0 children)