I have encountered an issue where a div is positioned above another div, and when I scroll the upper div to the bottom, it ends up scrolling the entire body. To better illustrate this problem, I have created a demo on JSFiddle: http://jsfiddle.net/2Ydr4/
Here is the HTML structure:
<div class="body">
<div class="above">
<!-- Content here longer than the height -->
</div>
</div>
And the relevant CSS:
.above {
width: 300px;
height: 200px;
overflow-y: scroll;
background: red;
z-index: 10;
position: fixed;
}
My question is, how can I prevent the body from scrolling when the floating div is scrolled to its top or bottom? Any help or insights would be greatly appreciated. Thank you!
EDIT: I forgot to mention that this issue was specifically observed on an iPad device. I've experimented with adding body {overflow: hidden}
as suggested by others, which does resolve the problem on desktop browsers but persists on touch-based browsers.