diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-03 02:31:11 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-03 02:31:26 +0200 |
commit | 8f574db911ebd7748f2462f423e92b275ce99b56 (patch) | |
tree | be94b44a0234af117b61415291001e897875aa3a /js/items.js | |
parent | 2bd67738356c425ea58da4cd84f847903c2e1f47 (diff) |
marking as viewed now works on jumping
Diffstat (limited to 'js/items.js')
-rw-r--r-- | js/items.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/js/items.js b/js/items.js index ecd8471e9..ad4f5513d 100644 --- a/js/items.js +++ b/js/items.js @@ -116,7 +116,7 @@ var t = t || function(app, string){ return string; }; // mock translation for lo $('.viewed').removeClass('viewed'); var notFound = true; $('.feed_item').each(function(){ - if(notFound && ($(this).position().top + $(this).outerHeight()) >= 0){ + if(notFound && ($(this).position().top + $(this).outerHeight()) > 1){ $(this).addClass('viewed'); notFound = false; } @@ -131,7 +131,8 @@ var t = t || function(app, string){ return string; }; // mock translation for lo var notJumped = true; $('.feed_item').each(function(){ if(notJumped && $(this).position().top > 1){ - self._jumpToElemenId($(this).data('id')); + var id = parseInt($(this).data('id')); + self._jumpToElemenId(id); notJumped = false; } }); @@ -147,7 +148,8 @@ var t = t || function(app, string){ return string; }; // mock translation for lo if(notJumped && $(this).position().top >= 0){ var previous = $(this).prev(); if(previous.length > 0){ - self._jumpToElemenId(previous.data('id')); + var id = parseInt(previous.data('id')); + self._jumpToElemenId(id); } notJumped = false; } @@ -159,9 +161,10 @@ var t = t || function(app, string){ return string; }; // mock translation for lo * @param number the number of the item starting with 0 */ Items.prototype._jumpToElemenId = function(id) { + $elem = $('.feed_item[data-id=' + id + ']'); this._$articleList.scrollTop( - $('.feed_item[data-id=' + id + ']').offset().top - - this._$articleList.offset().top + this._$articleList.scrollTop()); + $elem.offset().top - this._$articleList.offset().top + this._$articleList.scrollTop()); + this._markCurrentlyViewed(); }; /** |