Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

infinite-scroll jquery plugin

I am trying to set up infinite-scroll on a site I am developing with Coldfusion, I am new to javascript and jquery so I am having some issues wrapping my head around all of this. Do I need to have pagination on my site in order to use the infinite-scroll plugin, or is there a way to do it with out it?

like image 814
rajh2504 Avatar asked Feb 20 '11 19:02

rajh2504


1 Answers

You do not need infinite scroll plug-in for this. To detect when scroll reaches end of page, with jQuery you can do

$(window).scroll(function () {     if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {       //Add something at the end of the page    } }); 

Demo on JsFiddle

like image 142
Hussein Avatar answered Sep 21 '22 21:09

Hussein