diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-03 03:14:17 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-03 03:14:17 +0200 |
commit | 37d7ad7c5b980ad8f0e94247d2cb63a82bfe2163 (patch) | |
tree | b22cde2b7caf0dff3314c3efe44ac8af84743e64 /js | |
parent | 74693ed2db27dbe732af1f44929a8976b0017050 (diff) |
fixed bug when feed whould not be marked as viewed
Diffstat (limited to 'js')
-rw-r--r-- | js/items.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/js/items.js b/js/items.js index 323d7b346..e0a8b7570 100644 --- a/js/items.js +++ b/js/items.js @@ -122,7 +122,9 @@ 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()) > 1){ + var visiblePx = Math.ceil($(this).position().top + $(this).outerHeight()); + console.log(visiblePx); + if(notFound && visiblePx > 2){ $(this).addClass('viewed'); notFound = false; } @@ -160,6 +162,15 @@ var t = t || function(app, string){ return string; }; // mock translation for lo notJumped = false; } }); + // in case we scroll more than the last element, just jump back to the + // last one + if(notJumped){ + var $items = $('.feed_item'); + if($items.length > 0){ + var id = parseInt($items.last().data('id')); + self._jumpToElemenId(id); + } + } }; /** @@ -178,8 +189,7 @@ var t = t || function(app, string){ return string; }; // mock translation for lo * the top area */ Items.prototype._setScrollBottom = function() { - var padding = this._$articleList.height(); - console.log(padding); + var padding = this._$articleList.height() - 80; this._$articleList.children('ul').css('padding-bottom', padding + 'px'); }; |