How to Create an Infinite Scrolling Gallery

Infinite scrolling - no pagination butttons are required

Pagination is a technique used to break large data sets into small blocks in order to reduce the server load. Rakhitha Nimesh used to create pagination buttons with page numbers and next/previous links. Now pagination has gained a new perspective with infinite scrolling - keep scrolling and data will keep coming until all the data is displayed. In this technique, the first set of data will be displayed initially. Once you scroll to the end of the window the next page of data will be generated and so on.

 

When the page is loaded you have to get the data from the database and display the initial result. Rakhitha Nimesh has stored the names of the images in a database table. He has simplified the code using basic syntax so that beginners can go through the tutorial without any problems. The result will be broken into pages of 12 images. So the code generates the first 12 results from the database table. Also keep in mind that $actual_row_count variable will hold the total number of images available in the table.

Comments

Be the first to write a comment

You must me logged in to write a comment.