0

I've currently been using jQuery Custom Scrollbar on a project. I have a main div with a scrollbar and another small div with a scrollbar inside the main div. And whenever I scroll the small div it triggers the main div to scroll when the scrollbar meets the end of the content. How do I prevent the main div from being scrolled when I scroll the small div?

Cheers.

kim
  • 1

1 Answers1

0

Difficult to answer without seeing the code. Usually, it is possible to stop events from bubbling up by using e.stopPropagation();. For example,

$('#someDiv').on('scroll', function(e) {
    e.stopPropagation();
    // rest of Scrollbar code
});

If you don't have access to, or prefer not to modify, the scroll event in the source code for the scrollbar, you'll need to track the event "end of scroll" for the small div and trigger a e.preventDefault() or e.stopPropagation();. Your code would be helpful for a more precise answer.

Alfred Wallace
  • 1,741
  • 1
  • 14
  • 32