I've illustrated the problem I'm describing in a Codepen here: https://codepen.io/anon/pen/KZOwdm?editors=1111
I have a title bar at the top of my page that with a fixed position at the top of the page (position: fixed;
).
The main content of my page is a scrollable list with a margin-top
to make sure it stays below the title bar. Clicking on any of these items brings in a slide-up
, which is a position: fixed;
div with z-index: 2;
that covers the whole page from just below the title bar down to the bottom of the screen.
I'm having problems with scroll on this slide-up
. I expect that scrolling over the slide-up would scroll only that div's content, rather than the entire page (including the contents underneath). This is especially frustrating when the contents underneath are very long. What I'm seeing is that once scrolling completes on the slide-up, the parent div starts scrolling.
In a typical scenario, this slide-up would be meant to cover the page, sort of like displaying a "new page". So, I would not expect the parent div to come into the equation at all when scrolling over the slide-up div. The second problem here is that scrolling on a mobile device seems to only scroll the parent, not the slide-up. How can this be accomplished?