can I add lightbox to flickr feed?

牧云@^-^@ 提交于 2019-12-11 09:54:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!