Fix problem search pagination
This commit is contained in:
parent
90ea6a7844
commit
d36a15d02d
1 changed files with 13 additions and 0 deletions
|
@ -3,6 +3,17 @@
|
||||||
window.has_next_page = {{1 if page_obj.has_next() else 0}};
|
window.has_next_page = {{1 if page_obj.has_next() else 0}};
|
||||||
window.loading_page = false;
|
window.loading_page = false;
|
||||||
$(function() {
|
$(function() {
|
||||||
|
function getQueryParams() {
|
||||||
|
var queryParams = {};
|
||||||
|
var query = window.location.search.substring(1);
|
||||||
|
var vars = query.split("&");
|
||||||
|
for (var i = 0; i < vars.length; i++) {
|
||||||
|
var pair = vars[i].split("=");
|
||||||
|
queryParams[pair[0]] = decodeURIComponent(pair[1]);
|
||||||
|
}
|
||||||
|
return queryParams;
|
||||||
|
}
|
||||||
|
|
||||||
$(window).on("scroll", function() {
|
$(window).on("scroll", function() {
|
||||||
if (window.loading_page || !window.has_next_page) return;
|
if (window.loading_page || !window.has_next_page) return;
|
||||||
var distanceFromBottom = $(document).height() - ($(window).scrollTop() + $(window).height());
|
var distanceFromBottom = $(document).height() - ($(window).scrollTop() + $(window).height());
|
||||||
|
@ -13,6 +24,8 @@
|
||||||
"page": window.page + 1,
|
"page": window.page + 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
params = Object.assign({}, getQueryParams(), params);
|
||||||
|
|
||||||
$.get("{{feed_content_url}}", params)
|
$.get("{{feed_content_url}}", params)
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
$(".has_next").remove();
|
$(".has_next").remove();
|
||||||
|
|
Loading…
Reference in a new issue