function loadFlickr(flickrid) {
// Display a loading icon in our display element
$('#feed').html('');
// Request the JSON and process it
$.ajax({
type: 'GET',
url: "http://api.flickr.com/services/feeds/photos_public.gne",
data: "id=" + flickrid + "&lang=en-us&format=json&jsoncallback=?",
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(
/^(.*?)_m\.jpg$/,
''
);
// Add the new element to the array
thumbs.push(img);
}
// Display the thumbnails on the page
$('#feed').html(thumbs.join(''));
// A function to add a lightbox effect
addLB();
},
dataType: 'jsonp'
});
}
A blog about random stuff, geeky stuff, sports stuff, and sometimes about food stuff, not to mention stuff stuff.
Thursday, 28 October 2010
Flickr API - JQuery Javascript Example
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment