Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#14 Code example from "JSON: What It Is, How It Works, & How to Use It"
function loadFlickr(flickrid)
// Display a loading icon in our display element
$('#feed').html('<span><img src="/blog/images/lightbox-ico-loading.gif" alt=""></span>');
// Request the JSON and process it
success:function(feed) {
// Create an empty array to store images
var thumbs = [];
// Loop through the items
for(var i=0, l=feed.items.length; i < l && i < 16; i)
// Manipulate the image to get thumb and medium sizes
var img = feed.items[i].media.m.replace(
'<a href="/blog/$1.jpg"><img src="/blog/$1_s.jpg" alt=""></a>'
// Add the new element to the array
// Display the thumbnails on the page
// A function to add a lightbox effect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment