Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation Load new page content at BOTTOM OF PAGE

    Hello

    Basically I have found and adapted the code:

    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) {
                    $('#projectscontainer').children().last().after(data);
                    alreadyloading = false;
                    nextpage++;
                });
            }
        }
    });
    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?

    Thanks
    Last edited by jbyrne; 03-12-2012 at 10:10 PM.

  • #2
    New Coder
    Join Date
    Mar 2012
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •