From 06979fa0829697ed3b0b1946a2ef7b43f308e2c4 Mon Sep 17 00:00:00 2001 From: Nick Espig Date: Tue, 4 Jun 2019 18:22:02 +0200 Subject: [PATCH] Load next page shortly before hitting the bottom This improves the user experience by loading in the next entries shortly before him getting to the bottom. It makes the scrolling more smooth without a break in between. It also fixes an error on my browser that scrolling never hits the defined number. When I debugged it I hit `.scrolltop` of 1092.5 and the `doc.height - win.height` of 1093, so the condition was never true. --- searx/static/plugins/js/infinite_scroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searx/static/plugins/js/infinite_scroll.js b/searx/static/plugins/js/infinite_scroll.js index 9cd582d7f..1a95756a0 100644 --- a/searx/static/plugins/js/infinite_scroll.js +++ b/searx/static/plugins/js/infinite_scroll.js @@ -1,7 +1,7 @@ $(document).ready(function() { var win = $(window); win.scroll(function() { - if ($(document).height() - win.height() == win.scrollTop()) { + if ($(document).height() - win.height() - win.scrollTop() < 150) { var formData = $('#pagination form:last').serialize(); if (formData) { $('#pagination').html('
');