Commit 2fc7caf0 authored by Steffen van Bergerem's avatar Steffen van Bergerem Committed by Jonne Haß

Fix infinite scroll console error

closes #6478
parent 4e5d09e6
......@@ -100,7 +100,8 @@ app.views.InfScroll = app.views.Base.extend({
infScroll : function() {
var $window = $(window),
distFromBottom = $(document).height() - $window.height() - $window.scrollTop(),
elementDistance = this.$el.children().last().offset().top - $window.scrollTop() - 500;
lastElOffset = this.$el.children().last().offset(),
elementDistance = lastElOffset ? lastElOffset.top - $window.scrollTop() - 500 : 1;
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