Created
August 24, 2014 09:29
-
-
Save shirashin/18b2b5b276c3b302b1f8 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
| timelinesListApp.directive "whenScrolled", ($window) -> | |
| (scope, element, attr) -> | |
| angular.element($window).bind "scroll", -> | |
| scrollTop = document.body.scrollTop || document.documentElement.scrollTop | |
| clientHeight = $window.innerHeight | |
| scrollHeight = document.body.scrollHeight || document.docomentElement.scrollHeight | |
| clientHeight = window.innerHeight if scrollHeight == clientHeight | |
| remain = scrollHeight - clientHeight - scrollTop | |
| if remain <= 30 | |
| scope.$apply(attr.whenScrolled) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment