2012-09-25 55 views
0

我使用的顏色框1.3版本,並呼籲顏色框與下面的代碼顏色框resize在不工作

$(".extractImages").colorbox({ 
    ajax:true, 
    speed:100, 
    initialWidth:'110px', 
    initialHeight:'85px', 
    rel:'popup', 
    fixed:true, 
    arrowKey:false, 
    href:function(){ 
     return $(this).attr('popup'); 
    }, 
    onLoad: function() { 
     $('#cboxClose').html(''); 
     $('#cboxCurrent').remove(); 
     $('#cboxNext').remove(); 
     $('#cboxPrevious').remove(); 
     $('#cboxTitle').remove(); 
    }, 
    onComplete : function() { 
     $('#cboxClose').html('<img class="popupClose" src="/public/images/close.png"/>'); 
     $.fn.colorbox.resize();    
    } 
    }); 

正如你可以看到我有所謂的大小調整方法上完成,但它給了我下面的錯誤

TypeError: $.fn.colorbox is undefined 
[Break On This Error] 

$.fn.colorbox.resize(); 

我也曾嘗試以下操作:

TypeError: $(".extractImages").colorbox is undefined 
[Break On This Error] 

$('.extractImages').colorbox.resize(); 

請幫我...

回答

1

你試過

onComplete : function() { 
$(this).colorbox.resize(); 
} 
1

你肯定colorbox加載?看起來你不包括頁面上的jquery.colorbox.js。此$.colorbox必須在控制檯中顯示function()

0
$(window).resize(function(){ 
     $.colorbox.resize({ 
      maxWidth:"auto", 
      width:95+'%', 
     }); 
});