javascript - Get tumblr like button to work with infinite scrolling -


i'm trying tumblr button work infinite scrolling.

below code doesn't work.

and after code work.

i unfamiliair javascript im not sure how mesh them make work

function( newelements ) {     var $newelems = $(newelements);     $newelems.hide();     $newelems.imagesloaded(function(){         $wall.masonry( 'appended', $newelems,{isanimated: false}, function() {             $newelems.fadein('fast');         });     });     });  $('#posts').show(0); }); 

here 1 works

function(newelements){     var $newelems = $(newelements).css("opacity","0").css("pointer-events","none");     $('.photoset-grid').photosetgrid({highreslinks: true,rel: $('.photoset-grid').attr('data-id'),gutter: '5px',oncomplete: function(){}});     $('.photoset-grid,.lightbox').each(function() {         $(this).magnificpopup({delegate: 'a',type: 'image',gallery:{enabled:true},removaldelay: 200,mainclass: 'mfp-fade'});     });     var $newelemsids = $newelems.map(function (){return this.id;}).get();     $newelems.imagesloaded(function(){         $newelems.css("opacity","1").css("pointer-events","auto");         $k.masonry('appended',$newelems,true);         console.log($newelems,$newelemsids);         tumblr.likebutton.get_status_by_post_ids($newelemsids);     }); }); 

thanks help.

edit: full code

$(window).load(function(){ var $wall = $('#posts'); $wall.imagesloaded(function(){ $wall.masonry({ itemselector: '.entry, .entry_photo', isanimated : false }); });  $wall.infinitescroll({ navselector : '#pagination', nextselector : '#pagination a', itemselector : '.entry, .entry_photo', bufferpx : 2000, debug : false, errorcallback: function() { $('#infscr-loading').fadeout('normal'); }}, function( newelements ) { var $newelems = $( newelements ); $newelems.hide(); $newelems.imagesloaded(function(){ $wall.masonry( 'appended', $newelems,{isanimated: false}, function()   {$newelems.fadein('fast');} ); }); }); $('#posts').show(0); });     

function( newelements ) {     var $newelems = $(newelements);     // ids new elements      var $newelemsids = $newelems.map(function (){return this.id;}).get();     $newelems.hide();     // tell tumblr need new likebutton statuses     tumblr.likebutton.get_status_by_post_ids($newelemsids);     $newelems.imagesloaded(function(){         $wall.masonry( 'appended', $newelems,{isanimated: false}, function() {             $newelems.fadein('fast');         });     });     $('#posts').show(0); }); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -