Disabling page scroll while scrolling in a DIV

Just so I don’t have to hunt this down again:

I have a DIV that contains a list of items on a larger page. This DIV is restricted in height. When I scroll in that DIV and get to the bottom of the DIV, the whole page will scroll down. This can be annoying. Here’s how to stop page scrolling via a DIV.

<script language="javascript">
function stopScroll(scrollHide) {
  var scroller = (scrollHide == true) ? 'hidden' : '';
  document.documentElement.style.overflow = scroller;
}
</script>

<div id="formList_container" onmouseout="stopScroll(false)" onmouseover="stopScroll(true)">

StumbleUpon It!

Comment¬