Skip to content

Instantly share code, notes, and snippets.

@nguyenj
Last active December 17, 2015 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nguyenj/5576885 to your computer and use it in GitHub Desktop.
Save nguyenj/5576885 to your computer and use it in GitHub Desktop.
Flick json feed
<div class="image-feed">
<div class="loading">
<p>Loading...</p>
</div>
</div>
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=61437579@N06&lang=en-us&format=json&jsoncallback=?", function (data) {
$('.loading').remove();
$.each(data.items, function (i, item) {
var d = new Date(item.date_taken);
var month = new Array();
month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var m = month[d.getMonth()];
$("<img />").attr("src", item.media.m).appendTo(".image-feed");
$("<p />").html(item.title).appendTo(".image-feed");
$("<time />").attr('datetime', Date.parse(d)).html(m + " " + d.getDate() + " " + d.getFullYear()).appendTo(".image-feed");
});
});
img, p, time
display: block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment