Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i want same like "infinite-scroll next page" mode #28

Open
metalbug opened this issue Mar 13, 2012 · 1 comment
Open

i want same like "infinite-scroll next page" mode #28

metalbug opened this issue Mar 13, 2012 · 1 comment

Comments

@metalbug
Copy link

$(function() {

/*This first part is just throwaway code to simulate a lazy loaded page.*/

var pages = [],
ran = 5,
$pages = $('.page-set'),
i = 0,
index = 0,
loading = false;

function addPage() {
var h_page = (Math.floor((1000 - 499) * Math.random()) + 500)
$pages.append('

  • Page ' + (index + 1) + '
  • ');
    index++
    };

    for (i = 0; i < ran; i++) {
    addPage(i)
    }
    $(window).scroll(function() {
    if (loading) {
    return
    }
    if ($(window).scrollTop() &gt; $(document).height() - $(window).height() - 200) {
    loading = true;
    setTimeout(function() {
    addPage();
    $(window).sausage('draw');
    loading = false
    },
    250)
    }
    });

    /*This is where the plugin is initialized.*/
    

    $(window).sausage();
    function t() {
    var time = new Date();
    return time.getTime()
    }
    var s = t();
    for (var i = 0; i < 50; i++) {
    $(window).sausage('draw')
    }
    $('#out').append((t() - s) + 'ms')
    });

    this one too complex
    i do not understand

    @metalbug
    Copy link
    Author

    who can help me fix this?
    http://jsfiddle.net/B5sAk/24/

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant