Created
July 30, 2018 23:39
-
-
Save gladchinda/103d00efb56b4304eff341e6810a51fd 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
| function ScrollController(offset) { | |
| this.offsets = { offsetY: offset }; | |
| } | |
| ScrollController.prototype.registerScrollHandler = function() { | |
| window.addEventListener('scroll', function(event) { | |
| if (window.scrollY === this.offsets.offsetY) { | |
| console.log(`${this.offsets.offsetY}px`); | |
| } | |
| }, false); | |
| } | |
| var controller = new ScrollController(100); | |
| controller.registerScrollHandler(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment