2010-01-28 72 views
2

在提到另外一個問題,我發現:How can I dynamically resize the jQuery Colorbox plugin?顏色框調整

如果我想調整的回調內部的顏色框,我會怎麼稱呼呢?另外,是否可以禁用滾動,直到調整大小完成,然後啓用它?

$("a[rel='colorbox']").colorbox({ 
     onComplete: function() { 
      ????.colorbox.resize(); // what in the world goes here to get the colorbox? 
     }, 
     preloading: true 
    }); 

回答

2

當你做到這一點:「我創建關聯到這個參考顏色框對象」

$("a[rel='colorbox']").colorbox(... 

你說

那麼你訪問它的屬性(對象換句話說),你只需要調用元素:

$("a[rel='colorbox']").colorbox(...; 

我不知道是否有在插件有我從未使用過它調整尺寸功能,但你應該可以這樣做:

$("a[rel='colorbox']").colorbox({ 
     onComplete: function() { 
      $("a[rel='colorbox'").colorbox.resize(); // what in the world goes here to get the colorbox? 
     }, 
     preloading: true 
    }); 
+0

謝謝,這沒有什麼意義,但它的工作原理。我認爲這將再次應用colorbox效果。 – Ciel 2010-01-28 18:13:25

8

$ .fn.colorbox.resize()也適用。