forked from zaclys/searxng
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.
This commit is contained in:
parent
8189b0d192
commit
06979fa082
|
@ -1,7 +1,7 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var win = $(window);
|
var win = $(window);
|
||||||
win.scroll(function() {
|
win.scroll(function() {
|
||||||
if ($(document).height() - win.height() == win.scrollTop()) {
|
if ($(document).height() - win.height() - win.scrollTop() < 150) {
|
||||||
var formData = $('#pagination form:last').serialize();
|
var formData = $('#pagination form:last').serialize();
|
||||||
if (formData) {
|
if (formData) {
|
||||||
$('#pagination').html('<div class="loading-spinner"></div>');
|
$('#pagination').html('<div class="loading-spinner"></div>');
|
||||||
|
|
Loading…
Reference in New Issue