DIV Overflow:scroll - disable page scroll whilst mouse is inside
Is it possible to disable the ability for the mouse wheel to scroll the page whilst it is inside a certain DIV. That way it can only scroll the div and not the page. JQuery libraries are installed so I imagine it would be something along the lines of .scroll() and stop.pagination but I do not know enough about how to do this.
Any ideas?
Marve开发者_如何转开发llous
Fixed it.
$('.scrollable').mouseenter(function(){
$('body').css('overflow', 'hidden');
});
$('.scrollable').mouseleave(function(){
$('body').css('overflow', 'auto');
});
Pure css.
For the div you want to scroll:
#divId {
overflow: scroll;
height: someHeight;
}
精彩评论