2012-07-30 52 views
0

我正在与lightbox2项目工作。 不幸的是,每次我尝试点击一张图片将其加载到灯箱中时,它仍保持空白。
我检查了请求..图像从Instagram正确加载。 我的项目:lightbox2空白

这是我的请求的代码:

function getImages(searchText){ 
    //removing the the last images of the search if there were any 
    $("img").remove(); 
    //making the ajax call 
    $.ajax({ 
     type: "GET", 
     dataType: "jsonp", 
     cache: false, 
     url: "https://api.instagram.com/v1/tags/"+searchText+"/media/recent?access_token=HEREISMYTOKEN", 
     success: function(data) { 
      for (var i=0; i <= 6; i++) { 
       var image = data.data[i].images.standard_resolution.url 
       $("#images").append("<a href='"+image+"' rel='lightbox[insta]' title='Alternately you can press the right arrow key.' ><img src="+data.data[i].images.thumbnail.url+" alt='Plants: image 2 0f 4 thumb' /></a>") 
       Lightbox.initialize(); 
      }; 
    } 
    }); 
} 

任何想法如何解决这一问题? 非常感谢!

回答

0

在研究了灯箱的工作方式后,我发现你的问题。

默认情况下,灯箱具有<img class="lb-image">

$("img").remove(); 

你应该要删除其中的img详细注明:

后你打电话给你getImages(searchText)功能,由于下方的功能删除。这应该可以解决你的问题。

+0

非常感谢!这对我有效。 – user1340431 2012-07-30 16:32:15