Answer the question
In order to leave comments, you need to log in
How to load content on scroll?
Tell me how to implement content loading when scrolling the page!
django2
paginator
{% if is_paginated %}
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}">«</a>
{% else %}
{% endif %}
{% for i in paginator.page_range %}
{% if page_obj.number == i %}
{{ i }}
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}">»</a>
{% else %}
{% endif %}
{% endif %}
Answer the question
In order to leave comments, you need to log in
First, you need to write a javascript code that will handle the scroll event, calculate the required page, make a request to the server, and display the data received from the server. Secondly, you need to write a view that, in response to an ajax request, will return json with the necessary data. The code added to the question will not be useful to you in this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question