mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
20 lines
390 B
JavaScript
20 lines
390 B
JavaScript
'use strict';
|
|
|
|
(function(){
|
|
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);
|
|
}
|
|
});
|
|
};
|
|
}
|
|
}());
|