jq-87
12/2/2013 - 4:43 PM

Detect when scroll position is at the bottom of page

Detect when scroll position is at the bottom of page

$(window).scroll(function(){
		var pageHeight = $(document).height(),
			windowHeight = $(window).height(),
			topDistance = $(document).scrollTop();

		if( pageHeight - topDistance  == windowHeight) {
			
			//load more content now
			console.log('reached the bottom');

		}

	});