glowingbear-mainbox/js/whenscrolled-directive.js
Tor Hveem df36d56fa7 Implement infinite scrolling
I't not perfect but it's a start.
2015-12-19 19:45:33 +01:00

21 lines
435 B
JavaScript

(function() {
'use strict';
var weechat = angular.module('weechat');
weechat.directive('whenScrolled', function() {
return function(scope, elm, attr) {
var raw = elm[0];
var fun = function() {
if (raw.scrollTop === 0) {
scope.$apply(attr.whenScrolled);
}
};
elm.bind('scroll', function() {
_.debounce(fun, 200)();
});
};
});
})();