Files
habitica/website/public/js/directives/when-scrolled.directive.js
2015-06-08 10:02:44 -04:00

18 lines
343 B
JavaScript

'use strict';
angular
.module('habitrpg')
.directive('whenScrolled', whenScrolled);
function whenScrolled() {
return function(scope, elm, attr) {
var raw = elm[0];
elm.bind('scroll', function() {
if (raw.scrollTop + raw.offsetHeight >= raw.scrollHeight) {
scope.$apply(attr.whenScrolled);
}
});
};
}