Last active
December 17, 2015 07:59
-
-
Save nguyenj/5576885 to your computer and use it in GitHub Desktop.
Flick json feed
This file contains 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 class="image-feed"> | |
<div class="loading"> | |
<p>Loading...</p> | |
</div> | |
</div> |
This file contains 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
$.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"); | |
}); | |
}); |
This file contains 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
img, p, time | |
display: block |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment