Commit 22882aa2 authored by augier's avatar augier Committed by Steffen van Bergerem

Infinite scroll triggered relative to last element top rather than window bottom

closes #6451
parent baba7161
# 0.5.4.0
## Refactor
* Improve infinite scroll triggering [#6451](https://github.com/diaspora/diaspora/pull/6451)
## Bug fixes
......
......@@ -98,12 +98,11 @@ app.views.InfScroll = app.views.Base.extend({
},
infScroll : function() {
var $window = $(window)
, distFromTop = $window.height() + $window.scrollTop()
, distFromBottom = $(document).height() - distFromTop
, bufferPx = 500;
var $window = $(window),
distFromBottom = $(document).height() - $window.height() - $window.scrollTop(),
elementDistance = this.$el.children().last().offset().top - $window.scrollTop() - 500;
if(distFromBottom < bufferPx) {
if(elementDistance <= 0 || distFromBottom < 500) {
this.trigger("loadMore");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment