I want to disable the body scroll when I have a popup div (for like a photo gallery viewer or such), however I don't want the scroll to be disabled for the child element.
I am using this right now, which disables all of the scrolls:
$('body').bind('mousewheel DOMMouseScroll', function(e) {
var scrollTo = null;
if (e.type == 'mousewheel') {
scrollTo = (e.originalEvent.wheelDelta * -1);
}
else if (e.type == 'DOMMouseScroll') {
scrollTo = 40 * e.originalEvent.detail;
}
if (scrollTo) {
e.preventDefault();
$(this).scrollTop(scrollTo + $(this).scrollTop());
}
});
So if I have an element class named, "popup" how could I accept that? Or better yet, how could I stop the event from affecting anything other than the body tag?