germanysbestkeptsecret / Wookmark-jQuery

A jQuery plugin to create a dynamic, multi-column layout.
MIT License
2.63k stars 759 forks source link

Load -N items on scroll. #158

Closed AnreeChess closed 10 years ago

AnreeChess commented 10 years ago

Hello! Is it possible to load on scroll only 10 items for example? Is there a way in plugin to do this already?

And i have also 2 questions: The page is here: http://elvirapepp.com/gallery_2.php

  1. my photos are nonstop loading on scroll... how can i stop it if all items are loaded?
  2. If i use filter i do not need to load all the items onscroll -- i need to load only by filter parameter.

Thanks to anyone in advance!!

Sebobo commented 10 years ago

Hi,

the number of items you load on scroll depends on the number of items your server sends on each request. This is actually not a feature of the plugin but a script in the endless scroll or api example.

To stop items from loading means you have to send a page variable with each request to your server script and if the server returns an empty result or a specific response you can remove the event handler of the onscroll event. Then no more requests will be made.

Filtering and loading from an API is a bit more difficult. In this case you should load all items at the start. I wouldn't combine those two things because the filtered result depends on how much items you have loaded from the server. But you could wait for the first click on a filter and then request these items from the server and show them.

But all of this is related to your implementation and not really related to the features of the plugin.

Regards

AnreeChess commented 10 years ago

Thanks! I'll try :)