/ Published in: jQuery
Expand |
Embed | Plain Text
<!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <title>Picasa Album with jQuery template</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="jquery.tmpl.js"></script> </head> <body> <script type="text/x-jquery-tmpl" id="picasa"> <li class="photo"><a href="${bigphoto}"><img src="${thumbnail}" alt="${title}" /></a></li> </script> <ol id="image-container"> </ol> <script> $.ajax({ type : 'GET', dataType : 'jsonp', url : 'http://picasaweb.google.com/data/feed/base/user/USER_NAME/albumid/ALBUM_ID?alt=json&kind=photo&hl=en_US&', success : function(photo){ var picasa = []; $.each(photo.feed.entry, function(index, object){ if( index === 8 ) return false; picasa.push({ thumbnail : object.media$group.media$thumbnail[2].url, bigphoto : object.content.src, title : object.title.$t }); }); $('#picasa').tmpl(picasa).appendTo('#image-container'); } }); </script> </body> </html>
You need to login to post a comment.
