问题
I'm trying to add lightbox to my flickr feed, but I'm not having much success...
Is this the correct way of adding "data-lightbox" to the created images??
JS
$('<ul />').prependTo('#weddings');
$.getJSON('http://api.flickr.com/services/feeds/photoset.gne?set=72157647565496672&nsid=127682596@N07&lang=en-us&format=json&jsoncallback=?', function(data) {
$.each(data.items, function(i,item) {
var squares = (item.media.m).replace('_m.jpg', '_q.jpg');
var large = (item.media.m).replace('_m.jpg', '_b.jpg');
if(i <= 20){
$('<img/>').attr({
alt: item.title,
data-lightbox: wedding,
src: large,
height: '300',
width: 'auto'
}).appendTo('#weddings ul').wrap('<li class="img"><a href="' + large + '"></a></li>');
}
});
});
来源:https://stackoverflow.com/questions/25859655/can-i-add-lightbox-to-flickr-feed