Created
January 17, 2017 19:48
-
-
Save ramonvictor/e0fe77a236d4dd5dbbdbb37e9f508dc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var target = document.querySelector('.modal-content'); | |
// Cross-browser listeners: `mousewheel DOMMouseScroll` | |
window.addEventListener('mousewheel', function(event) { | |
var elHeight = target.clientHeight; | |
var scrollTop = target.scrollTop; | |
var scrollHeight = target.scrollHeight; | |
if ((event.deltaY < 0 && scrollTop == 0 ) || | |
(event.deltaY > 0 && scrollTop + elHeight >= scrollHeight)) { | |
event.preventDefault(); | |
return; | |
} | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment