Created
May 13, 2015 20:17
-
-
Save manfromanotherland/89d0e81b579bc7d09c08 to your computer and use it in GitHub Desktop.
JS: Embed Facebook last image #snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="facefeed"> | |
| <!-- images will appear here --> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function (gallery_id) { | |
| var faceFeed = $('#facefeed'); | |
| // images | |
| $.getJSON('//graph.facebook.com/' + gallery_id + '/photos?callback=?', function(json, status, xhr) { | |
| var imgs = json.data; | |
| for (var i = 0, l = 5; i < l; i++) { | |
| $('<a href="' + imgs[i].link + '" target="_blank" title="' + imgs[i].name + '">' + '<img src="' + imgs[i].images[3].source + '" width="' + imgs[i].width + '" height="' + imgs[i].height + '">' + '</a>').appendTo(faceFeed); | |
| } | |
| }); | |
| })('0000000'); // put the gallery ID here (usually Timeline) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment