jquery - Loading paginated images in a facebook gallery -
i'm attempting create gallery loading images facebook album.
however, i'm running problem facebook has limit of 25 images per page, , can't work out way use json paging response collect further data.
any advice on incorporating response code appreciated.
thanks!
$(document).ready(function() { (function (gallery_id) { var title = $('h3'), thumbs = $('.thumbs'); // album info $.getjson('//graph.facebook.com/' + gallery_id + '?callback=?', function(json, status, xhr) { title.html('<a href="' + json.link + '">' + json.name + '</a> ' + json.from.name); }); // images $.getjson('//graph.facebook.com/' + gallery_id + '/photos?callback=?', function(json, status, xhr) { var imgs = json.data; (var = 0, l = imgs.length - 1; < l; i++) { $('<div><img src="' + imgs[i].images[3].source + '" data-img="' + imgs[i].images[0].source + '" data-fullsize="' + imgs[i].images[0].source + '"></div').appendto(thumbs); } $('.thumbs').superbox(); }); })('406683109390041'); }); in use here: vikingsofmiddleengland.co.uk/beta/gallery.html
you may increase limit of photos adding limit request //graph.facebook.com//album_id/photos/?limit=100,
if have many photos, should paginate since , until parameters this:
//graph.facebook.com/album_id/photos?limit=25&until=1298957761 since , until parameter unix timestamp or can crawl next 50 photos through offset parameter
//graph.facebook.com/album_id/photos?limit=25&offset=50 .
there other ways of paginating between objects through graph api, should this, pagination graph api
then may build function fetch next few photos. can trigger through button or can fetch them @ time interval or can use callback function re-request server.
Comments
Post a Comment