2010-01-28 73 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()也适用。