Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling mouse scrolling

I have a page with a textbox in it. When I scroll the textbox to the bottom, the document will scroll after it. How to disable mouse scrolling for the document but enable scrolling for the textbox when mouse is over textbox? I only need to disable mouse scroll and not window scrollbars.

The page has a fixed size and there will only be scrollbars when the browser window is not maximized. The document has a 800x600 px size and should fit for most users I think.

I'm using JavaScript with jQuery.

like image 950
VeroLom Avatar asked Oct 27 '11 12:10

VeroLom


1 Answers

$('#txt').hover(function (){
    $('body').css('overflow','hidden');
}, function (){
    $('body').css('overflow','auto');
})
like image 62
Sameera Thilakasiri Avatar answered Sep 24 '22 05:09

Sameera Thilakasiri