So I\'m using the colorbox plugin for a contact form. I am just the default colorbox properties, so it should automatically adjust to the div it contains (right?).
Well
I wasn't using images so the accepted answer didn't work for me. Also, it only happened when using inline: true and appeared to off by the height of the X button in the bottom right. To fix it, I added a new property called inlineHeightAdjustment
and then used it within the getHeight
function.
In jquery.colorbox.js:
function getHeight() {
settings.h = settings.h || $loaded.height();
settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
// Adjust height for inline boxes
settings.h = settings.inline ? settings.h + settings.inlineHeightAdjustment : settings.h;
return settings.h;
}
Then on my pages:
$(".inlineColorBox").colorbox({
inline: true,
inlineHeightAdjustment: 25,
});
You could probably make it better by accepting a string so you could specify em, px, %, etc. but I knew I wanted pixels thus the numerical value assumption.