From 271b9f57681686093183f4924300c1622964fc56 Mon Sep 17 00:00:00 2001 From: "Martin H. Normark" Date: Wed, 7 Jan 2015 00:16:16 +0100 Subject: [PATCH] Load next page if scrollHeight <= clientHeight closes #4764 - call loadNextPage in attachCheckScroll, if element scrollHeight <= clientHeight --- ghost/admin/mixins/pagination-view-infinite-scroll.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ghost/admin/mixins/pagination-view-infinite-scroll.js b/ghost/admin/mixins/pagination-view-infinite-scroll.js index c25705dd8b..7db98a10d9 100644 --- a/ghost/admin/mixins/pagination-view-infinite-scroll.js +++ b/ghost/admin/mixins/pagination-view-infinite-scroll.js @@ -22,9 +22,14 @@ var PaginationViewInfiniteScrollMixin = Ember.Mixin.create({ * Bind to the scroll event once the element is in the DOM */ attachCheckScroll: function () { - var el = this.$(); + var el = this.$(), + controller = this.get('controller'); el.on('scroll', Ember.run.bind(this, this.checkScroll)); + + if (this.element.scrollHeight <= this.element.clientHeight) { + controller.send('loadNextPage'); + } }.on('didInsertElement'), /**