summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Espig <nickespig@gmail.com>2019-06-04 18:22:02 +0200
committerNick Espig <nickespig@gmail.com>2019-06-04 18:22:02 +0200
commit06979fa0829697ed3b0b1946a2ef7b43f308e2c4 (patch)
tree2caded25c96f1b122a889606c9d3c6e53fe2f5fc
parent8189b0d192224abe9e8ce61747328ebdc34fabb1 (diff)
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.
-rw-r--r--searx/static/plugins/js/infinite_scroll.js2
1 files changed, 1 insertions, 1 deletions
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('<div class="loading-spinner"></div>');