PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, July 8, 2022

[FIXED] how to get the index number of my Tumblr posts when in Infinite Scroll

 July 08, 2022     callback, indexing, infinite-scroll, posts, tumblr     No comments   

Issue

$('#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


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.



Answered By - hhff
Answer Checked By - Cary Denson (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,214,370

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing