Similar question to this Scrolling only the distance of a modal on smaller screens with media queries
The answer I gave was this. http://jsfiddle.net/mgGS7/1/
The fiddle has your webpage inside one div. So the header, content, and footer are inside a div. This would make the solution a lot easier.
<div class = "popup">
<div class = "over"></div>
<div class = "window">
<button class = "close">Close</button>
</div>
</div>
<div class = "content">
<p>Filler</p>
<button class = "pop">Popup</button>
<p>Filler</p>
<p>Filler</p>
<button class = "pop">Popup</button>
<p>Filler</p>
</div>
var scroll;
$('.pop').click (function () {
scroll = $(document).scrollTop ();
$('.popup').show ();
$('.content').offset ({top:-scroll}).addClass ('paused');
});
$('.close').click (function () {
$('.popup').hide ();
$('.content').removeClass ('paused').removeAttr ('style');
$(document).scrollTop (scroll);
});
Your webpage would be inside .content
. Essentially when you click the popup, the webpage's scroll is saved and it becomes fixed at that position so it can't move. Once the popup goes away the it's no longer fixed and it's scroll position is restored.
This is one way of doing it. Another way would be to listen for the mouse wheel events and do some kind of logic there like e.preventDefault ()
or something. Here's a link on listening for mouse wheel events. JQuery / JS : Detect user's scroll attempt without any window overflow to scroll to