Using Tumblr Like Button with Infinite Scroll -


i'm trying use new tumblr buttons within infinite scroll (allowing theme button on individual tumblr posts homepage) work first 15 posts of first 'page' loads page button stops working. these instructions given tumblr on docs page:

function: tumblr.likebutton.get_status_by_page(n)
description: call function after requesting new page of posts. takes page number loaded integer.

function: tumblr.likebutton.get_status_by_post_ids([n,n,n])
description: request status individual posts. takes array of post ids.

as i'm not sure how apply jquery i'm not sure add these functions, here js current theme:

    // masonry     var $container = $('#content');      $container.imagesloaded( function(){         $container.masonry({             itemselector: '.entry',             columnwidth: 220         });     });      // infinite scroll     $container.infinitescroll({         navselector  : '#pagination',         nextselector : '#pagination li a.pagination_nextlink',         itemselector : '.entry',         loading: {             img: 'http://static.tumblr.com/glziqhp/k37m9yaub/257__1_.gif'         }     },      function( newelements ) {         var $newelems = $( newelements ).css({             opacity: 0         });         $newelems.imagesloaded(function(){             $newelems.animate({                 opacity: 1             });             $container.masonry(                 'appended', $newelems, true             );          });     }); 

first need add unique post id each of posts:

<div class="entry masonry-brick" id="{postid}">...</div> 

the documentation mentions requesting status once new posts (or new page) has been appended / loaded:

function( newelements ) {     var $newelems = $( newelements ).css({         opacity: 0     });      // create array of $newelems ids     var $newelemsids = $newelems.map(function () {          return this.id;      }).get();      $newelems.imagesloaded(function(){         $newelems.animate({             opacity: 1         });         $container.masonry(             'appended', $newelems, true         );          // let's see have, remove console.log() if working         console.log($newelems, $newelemsids);           tumblr.likebutton.get_status_by_post_ids($newelemsids);     }); }); 

i hope points in right direction.


Comments