2010-11-30 51 views
0

我使用這個變焦圖像腳本大拇指加載到較大的圖像: http://www.eyecon.ro/zoomimage/#implement如何通過jquery添加更多內容再次加載函數?

麻煩的是我加載畫廊中的頁面使用jQuery負載(下面的代碼)加載之後:

//Remove tab info and add gallery 
$(".more").click(function() { 
    var $gallery = $(this).closest('.tab').find('.gallery'), 
    cat = $(this).attr('href').split('cat=')[1]; 

    if ($gallery.is(':empty')) { 
    $gallery.load('/public/themes/lbd/js/imagegallery.php', {'cat': cat}, function(){ 
    $(this).fadeIn(); 
    }); 
    } 

    $gallery.siblings().fadeOut(function(){ 
    $gallery.fadeIn(); 
    }); 
    return false; 
}); 

麻煩的是這個腳本創建在飛行畫廊所以下面的代碼將無法正常工作

<script type="text/javascript"> 
    $(document).ready(function() { 
     $('a.customGal').zoomimage(); 
    }); 
</script> 

我怎麼能在上面的代碼工作,一旦庫被加載,從而運行函數完成?

我試圖添加$('a.customGal')。zoomimage();在.load中但它仍然不起作用。

回答

0

如果我正確理解您的問題,您正嘗試創建一個不在a.customGal s的圖庫,但是您的代碼無法正常工作,因爲這些錨點在頁面加載時不存在。它們從.click加載。

如果這是正確的,我認爲這應該工作:

$gallery.load('/public/themes/lbd/js/imagegallery.php', {'cat': cat}, function(){ 
    $(this).fadeIn(function(){ 
     $('a.customGal').zoomimage(); 
    }); 
}); 

,將調用插件的HTML已被添加到您的頁面和結束後動畫。

+0

對不起,我只是剛剛注意到這個帖子... – Andy 2010-11-30 20:53:43