Append AJAX items to masonry with infinite scroll -
i've searched around , looked @ bunch of different logic, , think i'm close can't infinite scroll script append data masonry. have ajax file while pulling data, , main line inside of file pulls data when scrolling:
function getdata() { // post data ajax.php $.post('ajax.php', { action : 'scrollpagination', number : $settings.nop, offset : offset, }, function(data) { // change loading bar content (it may have been altered) $this.find('#spinner').html($initmessage); // if there no data returned, there no more posts shown. show error if(data == "") { $this.find('#spinner').hide(); } else { // offset increases offset = offset+$settings.nop; // append data content div $this.find('.content').append(data); // no longer busy! busy = false; } }); }
i've tried making edits line "$this.find('.content').append(data);" taking data , putting content div sitting inside of masonry function in main index file.
i've tried things such as
$this.find('.content').append(data).masonry ('reload');
but can't work , have append data.
the rest of code working, , scrolling working , pulling data, won't append masonry.
any tips, feel i'm missing minor.
thanks in advance!
i had same issues masonry (the new version 3). key .filter() ajax/get/post returns. there bug masonry can read here, work around use .filter().
// make jquery object html string var $moreblocks = jquery(data).filter('div.block'); // append new blocks container jquery('#container').append( $moreblocks ); // have masonry position new blocks jquery('#container').masonry( 'appended', $moreblocks );
i made little demo out here: http://labs.funkhausdesign.com/examples/masonry/appended.html
Comments
Post a Comment