Question

$('#content').infinitescroll({
        binder: $(window),
        debug: true,
        itemSelector : ".post",
        navSelector  : "#pagination",
        nextSelector : "#next-page"

        },function(arrayOfNewElems){  

    });

basically, I want to display the number my Tumblr posts. I have made different attempts but each time the index numbering starts again from 0 after the new content is loaded. How can I make the number a continuation from the previously loaded posts.

what kind of function should i be invoking in

function(arrayOfNewElems){

});

this is the plugin im using

https://github.com/paulirish/infinite-scroll

Was it helpful?

Solution

Just do:

var totalPosts = null;

$.ajax({
    url: "http://[BLOG NAME HERE].tumblr.com/api/read/json",
    dataType: 'jsonp',
    success: function(results){
        totalPosts = results['posts-total'];
        alert(totalPosts);
    }
});

Needs jQuery but can be run before the document is loaded.

OTHER TIPS

why u need to get the index number os ur posts? i think this is also can work

Infinite-scrolling with proto.jp

http://codysherman.com/tools/infinite-scrolling

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top