Web Analytics Made Easy -
StatCounter Scrolling div and browser window - CodingForum


No announcement yet.

Scrolling div and browser window

  • Filter
  • Time
  • Show
Clear All
new posts

  • Scrolling div and browser window

    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?


  • #2
    You need a custom mousewheel handler that cancels the default behaviour then replicates it for the current element. You can evaluate this script that provides your desired functionality as a by-product.
    Last edited by Calvert Tripesi; Sep 12, 2011, 02:36 PM.