Last active
December 15, 2015 13:29
-
-
Save r38y/5268092 to your computer and use it in GitHub Desktop.
Fixes the bouncing viewport when scrolling in full-window javascript apps. You mostly see this in Chrome (?).
This file contains 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
# Uses https://github.com/brandonaaron/jquery-mousewheel | |
fixScrolling: (elem) -> | |
$('body').on 'mousewheel', elem, (e, d) -> | |
$elem = $(elem) | |
height = $elem.height() | |
scrollHeight = $elem.get(0).scrollHeight | |
if (d < 0 && (this.scrollTop is (scrollHeight - height)) || (d > 0 && this.scrollTop is 0)) | |
e.preventDefault() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment