rochal / jQuery-slimScroll

small jQuery plugin that transforms any div into a scrollable area with a nice scrollbar. Demo and more:
http://rocha.la/jQuery-slimScroll
2.23k stars 927 forks source link

allowPageScroll:false does not work when the div has no content #56

Open ibc opened 11 years ago

ibc commented 11 years ago

I apply .slimScroll({height: '250px'}) to a div which initially has no content. If I press the mousewheel then the page is scrolled.

It seems that allowPageScroll:false just works when the div has more content than the size of the div, this is, just when the scroll appears. IMHO the page should not be scrolled in that case.

ibc commented 11 years ago

Is there, at least, any workaround for avoiding page scroll when the slimScroll div has a content smaller than the div itself?

ibc commented 11 years ago

Found the workaround:

$('div.scrollable'.on('mousewheel', function(e) {
  e.preventDefault();
});