Prevent scroll event propagation in mCustomScrollbar

Fynn picture Fynn · Feb 16, 2014 · Viewed 8.5k times · Source

I am using the jQuery custom content scroller to create custom scrollers on div elements. When scrolling inside of a div and reaching the bottom end of the div, the page will start scrolling. Is there a way to prevent the scroll event from propagating?

I have created a http://jsfiddle.net/7CPv5/ to illustrate the issue. Just resize the browser to create a vertical scrollbar and start scrolling inside the "Hello World" div. I am calling the plugin like this:

$('#scrollable').mCustomScrollbar({
    scrollInertia: 0
});

Answer

user2140041 picture user2140041 · Jun 3, 2014

Different way to solve this:

$("#scrollable").mouseenter(function(){     

   $("#content-md").mCustomScrollbar("disable");  

}).mouseleave(function(){

   $("#content-md").mCustomScrollbar("update");

});