Created
August 29, 2016 20:01
-
-
Save danielrw7/8b5a308e6d3a6ce6c30f02704cb40e90 to your computer and use it in GitHub Desktop.
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
var scrollLock = { | |
scrollTop: 0, | |
lock: function(scrollTop) { | |
if (typeof scrollTop == "number") { | |
this.scrollTop = scrollTop; | |
} | |
$(window).on("scroll", this.onScroll); | |
}, | |
unlock: function() { | |
$(window).off("scroll", this.onScroll); | |
} | |
}; | |
scrollLock.onScroll = (function() { | |
$(window).scrollTop(this.scrollTop); | |
}).bind(scrollLock); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment