views:

923

answers:

2

In reference to another question I found : http://stackoverflow.com/questions/1060687/how-can-i-dynamically-resize-the-jquery-colorbox-plugin

If I wanted to resize the colorbox inside of a callback, how would I call it? Also, would it be possible disable scrolling until the resize was complete, then enable it?

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

When you do this:

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

You're saying "create me a colorbox object associated to this reference."

So for you to access it's properties (the object in other words) you just call the element:

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

I have no idea if there is a resize function in that plugin has i never used it, but you should be able to do it like this:

$("a[rel='colorbox']").colorbox({
        onComplete: function() {
            $("a[rel='colorbox'").colorbox.resize(); // what in the world goes here to get the colorbox?
        },
        preloading: true
    });
fmsf
Thank you, that doesn't make a lot of sense, but it works. I figured that would apply the colorbox effect a second time.
Stacey
+1  A: 

$.fn.colorbox.resize() works as well.

Derek Adair