How do you resize Fancybox at runtime?

Swiftaxe picture Swiftaxe · Jun 15, 2009 · Viewed 95.8k times · Source

Does anyone know how to resize the jQuery Fancybox during runtime?

When initializing the fancybox I can do this:

$("tag").fancybox({ 'frameWidth': 500, 'frameHeight': 700 });

I am filling the fancybox with dynamic content and I want it to resize according to the content.

Answer

Jason Norris picture Jason Norris · Mar 24, 2010

If you are using version 1.3 of Fancybox, there is a resize method:

$.fancybox.resize();

For version 2.x of Fancybox the same would be done with:

$.fancybox.update()

Which will resize the active fancybox based on the size of the content inside it.