Heisenberg
Heisenberg

Reputation: 495

How To Load The Next Page When User Scrolls Down In Django

I was trying to build a blog website and was wondering to add a functionality that loads a new page as the user scroll down. I found some other answers to this but they all have some JSON or Javascript in them. As I Don't know any of these languages, I was wondering if there was a way I can do this just using Django Pagination And Stuff.

Thanks In Advance.

Upvotes: 0

Views: 377

Answers (2)

Saeed Alijani
Saeed Alijani

Reputation: 313

You can install Django EL(Endless) Pagination and using this package to endless pagination. Using and configuration of this package is very simple.

Upvotes: 1

Tim Woocker
Tim Woocker

Reputation: 1996

Django will only run on your server. The client won't run any python related code on their machine. Usually, browsers display HTML/CSS and can run client-side code in JavaScript.

So since the browser does not get in contact with django itself, you must use JavaScript to do anything after the page has been loaded.

It's not much javascript you will need, so start reading this: https://www.w3schools.com/js/

Information on how to get the scrollbar in JS: How to get scrollbar position with Javascript?

Upvotes: 2

Related Questions