View Full Version : Scrolling div and browser window

09-12-2011, 07:33 PM
Hello, I was wondering if there is a way to prevent the browser window from scrolling when you are scrolling inside an overflow auto div and reach the end of the div's scroll? Right now I have a few people complaining about a div that loads scrolling info on the screen and when they scroll down using the mouse wheel and get to the bottom of the div then the rolling of the mouse wheel starts scrolling the browser window. It would be nice if the browser could see that your cursor is over the div and even though it reaches the end, not scroll the window unless you move the cursor outside of the div that you are currently scrolling.

Any ideas or is this just something we have to deal with?


Calvert Tripesi
09-12-2011, 08:33 PM
You need a custom mousewheel handler that cancels the default behaviour then replicates it for the current element. You can evaluate this script (http://scripterlative.com/files/dragdivscroll.htm) that provides your desired functionality as a by-product.