Skip to content

Instantly share code, notes, and snippets.

@mrgenixus
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save mrgenixus/44b5d62d465a8dcaa1a3 to your computer and use it in GitHub Desktop.

Select an option

Save mrgenixus/44b5d62d465a8dcaa1a3 to your computer and use it in GitHub Desktop.
$(function() {
var counter =0;
function loadNext() {
$('<div>').load('api/thumbnails/whatever/your/url/is?page=' + counter++).appendTo('#thumbnails');
}
$(window).on('scroll', function() {
if ($(document).scrollTop() > document.body.height() - (window.clientHeight / 25)) {
loadNext();
});
loadNext();
});
$(document).on('click', '.thumbnail', function() {
var url = $(this).data('url');
lightboxme(url);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment