Javascript lightbox2挡片

Javascript lightbox2挡片,javascript,jquery,html,lightbox,lightbox2,Javascript,Jquery,Html,Lightbox,Lightbox2,我正在从事lightbox2的一个项目。 不幸的是,每次我尝试单击图片将其加载到lightbox中时,该框都保持空白白色。 我检查了请求..图像从Instagram正确加载。 我的项目: 这是我请求的代码: function getImages(searchText){ //removing the the last images of the search if there were any $("img").remove(); //making the ajax c

我正在从事lightbox2的一个项目。 不幸的是,每次我尝试单击图片将其加载到lightbox中时,该框都保持空白白色。
我检查了请求..图像从Instagram正确加载。 我的项目:

这是我请求的代码:

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();
            };
    }
    });
}
函数getImages(searchText){ //删除搜索的最后图像(如果有) $(“img”).remove(); //进行ajax调用 $.ajax({ 键入:“获取”, 数据类型:“jsonp”, cache:false, url:“https://api.instagram.com/v1/tags/“+searchText+”/media/recent?access_token=HEREISMYTOKEN”, 成功:功能(数据){
对于(var i=0;i我在研究了lightbox的工作原理后发现了您的问题

默认情况下,带有
的lightbox

调用
getImages(searchText)
函数后,由于使用了以下函数,该函数将被删除:

$("img").remove();
您应该详细指定要删除的img。这应该可以解决您的问题