infinite scrolling only div part and not hole page

infinite scrolling only div part and not hole page

hi!

i want to load specified div for my infinite scrolling, not hole page. i know i have to use valid jquery selector at load, but i make it wrong always in my testings. i used below code for page scrolling, but how i make it to only div loading scrolling and not hole pages?

  1. jQuery(document).ready(function() {
        //location.href = 'index.html#start';
        var pages = new Array();
        var current = 0;
        var loaded = new Array();
        $('#pages a').each(function(index) {
            pages[index] = $(this).attr('href');
            loaded[$(this).attr('href')] = 0;
        });
        $(window).scroll(function(e) {
            if ($(window).scrollTop() + $(window).height() >= $(
                document).height() - 300) {
                console.log("bottom of the page reached!");
                loaded[pages[current + 1]] = loaded[pages[current +
                    1]] + 1;
                if (loaded[pages[current + 1]] <= 1) loadMoreContent(
                    current + 1);
            }
        });

        function loadMoreContent(position) {
            if (position < pages.length) {
                $('#loader').fadeIn('slow', function() {
                    $.get(pages[position], function(data) {
                        $('#loader').fadeOut('slow',
                            function() {
                                $(
                                    '#scroll-container'
                                ).append(data).fadeIn(
                                    999);
                                current = position;
                            });
                    });
                });
            }
        }
    });