2012-07-30 46 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