diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-03 03:00:36 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-09-03 03:00:36 +0200 |
commit | 74693ed2db27dbe732af1f44929a8976b0017050 (patch) | |
tree | d2be725ba95bb04327a9b50642e8db962546a84d /js | |
parent | 8f574db911ebd7748f2462f423e92b275ce99b56 (diff) |
add padding to the bottom to be able to scroll even with one element
Diffstat (limited to 'js')
-rw-r--r-- | js/items.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/js/items.js b/js/items.js index ad4f5513d..323d7b346 100644 --- a/js/items.js +++ b/js/items.js @@ -32,6 +32,11 @@ var t = t || function(app, string){ return string; }; // mock translation for lo this._$articleList.scrollTop(0); this._itemCache = new ItemCache(); this._$articleList.children('ul').children('.feed_item:eq(0)').addClass('viewed'); + + this._setScrollBottom(); + $(window).resize(function(){ + self._setScrollBottom(); + }); // mark items whose title was hid under the top edge as read // when the bottom is reached, mark all items as read @@ -105,6 +110,7 @@ var t = t || function(app, string){ return string; }; // mock translation for lo self._$articleList.children('ul').show(); } self._$articleList.removeClass('loading'); + self._setScrollBottom(); }); }; @@ -167,6 +173,16 @@ var t = t || function(app, string){ return string; }; // mock translation for lo this._markCurrentlyViewed(); }; + /** + * Adds padding to the bottom to be able to scroll the last element beyond + * the top area + */ + Items.prototype._setScrollBottom = function() { + var padding = this._$articleList.height(); + console.log(padding); + this._$articleList.children('ul').css('padding-bottom', padding + 'px'); + }; + /** * Empties the item cache */ |