Explorar o código

Improved auto load more articles

Fixed bug + ealier trigger of load more (half of the window height
instead of 0)
Alexandre Alapetite %!s(int64=7) %!d(string=hai) anos
pai
achega
54a86990e6
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      p/scripts/main.js

+ 3 - 3
p/scripts/main.js

@@ -592,9 +592,9 @@ function onScroll() {
 		}
 		}
 	}
 	}
 	if (context.auto_load_more) {
 	if (context.auto_load_more) {
-		const load_more = document.getElementById('mark-read-pagination');
-		if (load_more && box_to_follow.scrollTop > 0 &&
-			box_to_follow.scrollTop + box_to_follow.offsetHeight >= load_more.offsetTop) {
+		const pagination = document.getElementById('mark-read-pagination');
+		if (pagination && box_to_follow.offsetHeight > 0 &&
+			box_to_follow.scrollTop + box_to_follow.offsetHeight + (window.innerHeight / 2) >= pagination.offsetTop) {
 			load_more_posts();
 			load_more_posts();
 		}
 		}
 	}
 	}