summaryrefslogtreecommitdiffstats
path: root/js/directive
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-13 14:36:27 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-13 14:36:27 +0200
commit11c4b03d70583d8b4c7e7bce408a3c3a3d9c1f17 (patch)
tree4c4148da2a22130974855103397a44e46024609c /js/directive
parente06aaac5120f95212598b54cd1fb6e2513e77b86 (diff)
mark read on scroll
Diffstat (limited to 'js/directive')
-rw-r--r--js/directive/NewsScroll.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/js/directive/NewsScroll.js b/js/directive/NewsScroll.js
index 26e799da6..e93c7091d 100644
--- a/js/directive/NewsScroll.js
+++ b/js/directive/NewsScroll.js
@@ -64,6 +64,7 @@ app.directive('newsScroll', function ($timeout) {
return {
restrict: 'A',
scope: {
+ 'newsScroll': '@',
'newsScrollAutoPage': '&',
'newsScrollMarkRead': '&',
'newsScrollEnabledMarkRead': '=',
@@ -74,6 +75,11 @@ app.directive('newsScroll', function ($timeout) {
},
link: function (scope, elem) {
var allowScroll = true;
+ var scrollArea = elem;
+
+ if (scope.newsScroll) {
+ scrollArea = $(scope.newsScroll);
+ }
var scrollTimeout = scope.newsScrollTimeout || 1;
var markReadTimeout = scope.newsScrollMarkReadTimeout || 1;
@@ -100,14 +106,13 @@ app.directive('newsScroll', function ($timeout) {
scope);
}, markReadTimeout*1000);
}
-
};
- elem.on('scroll', scrollHandler);
+ scrollArea.on('scroll', scrollHandler);
// remove scroll handler if element is destroyed
scope.$on('$destroy', function () {
- elem.off('scroll', scrollHandler);
+ scrollArea.off('scroll', scrollHandler);
});
}
};