View Full Version : Load new page content at BOTTOM OF PAGE

03-12-2012, 09:03 PM
Hello :)

Basically I have found and adapted the code:

alreadyloading = false;
nextpage = 2;

$(window).scroll(function() {
if ($('body').height() <= ($(window).height() + $(window).scrollTop())) {
if (alreadyloading == false) {
var url = "page"+nextpage+".html";
alreadyloading = true;
$.post(url, function(data) {
alreadyloading = false;

I want when the user scrolls to the bottom of the page for content in a new page to load under the div "#projectscontainer". So in the new page 'Page2.html" I have put 5 divs going down with content in...

I want the new content to appear below "#projectscontainer'"

Why won't this work? Anyone know?


03-12-2012, 11:38 PM
Ok now have resolved this particular issue but now have another one...

I changed the line of code to " if($(window).scrollTop() + $(window).height() == $(document).height()) {"

So now it loads when the bottom of the screen is hit instead...

Now the first page loads into the correct div, but the next page loads below the footer... frustrating