Skip to content

Instantly share code, notes, and snippets.

@Kcko
Last active August 29, 2015 14:07
Show Gist options
  • Save Kcko/216b0ea894cab8fb0231 to your computer and use it in GitHub Desktop.
Save Kcko/216b0ea894cab8fb0231 to your computer and use it in GitHub Desktop.
Ajaxové načítaní při onscrollu
if($('.load-next').length > 0) {
var $window = $(window);
$(window).scroll(function(){
var $loadNext = $('.load-next');
if($loadNext.length) {
var winHeight = $window.height();
var scrollTop = $window.scrollTop();
var loadNextOffset = $loadNext.offset();
if((winHeight + scrollTop + 200) > loadNextOffset.top) {
$loadNext.trigger('click').remove();
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment