0

Does anyone have a suggestion on how to extend a site automatically?

For example the site "9gag.com" also known as 9fag. It loads a part into the browser, but as you scroll, the site extends itself, without the need to click on "the next site".

I woule like to use this in on a shop I created.

For example here:

http://saasil.de/wohnraumleuchten/deckenleuchten/

When you scroll down, you see that you can choose to go to the 2nd site...

It would be great if someone could just point me to the correct technology to use here.

2 Answers2

1

Have a look at this question on SO. In this example, the page will extend 100px before reaching the bottom of the page

function loadMore()
{
    console.log("More loaded");
    // load your content (e.g. via ajax)
    $("body").append("<div>");
    $(window).bind('scroll', bindScroll);
}

function bindScroll()
{
    if($(window).scrollTop() + $(window).height() > $(document).height() - 100) 
    {
        $(window).unbind('scroll');
        loadMore();
    }
}

$(window).scroll(bindScroll);​

thanks to JoeFletch!

Community
  • 1
  • 1
lionheart98
  • 918
  • 1
  • 10
  • 25
1

As someone mentioned above in comments, you are searching for infinite-scroll. There is plenty of jQuery plugins which can help you achieve desired effect. Of, course if you are loading content dinamicaly, you can fetch your data with AJAX.

Similar technology is used at Twitter, Pinterest, etc, and of course on 9gag. You can see explanation and working demo at http://www.fieg.nl/infinite-ajax-scroll-a-jquery-plugin

Alan Kis
  • 1,790
  • 4
  • 24
  • 47