Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FancyBox resize width

I'm able to resize the height with the $.fancybox.resize(); part, but the width just doesn't update according to the new content. Thoughts?

like image 454
johnnyArt Avatar asked Mar 07 '10 23:03

johnnyArt


People also ask

What is fancyBox in HTML?

Media types. fancybox is designed to display images, video, iframes and any HTML content. For your convenience, there is a built in support for inline content and ajax. Images.

Is fancyBox open source?

fancybox - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers.


1 Answers

From the fancybox api docs:

$.fancybox.resize: "Auto-resizes FancyBox height to match height of content."

So it looks like it is not intended to adjust the width.

If you wish to adjust the width, you can do it by manually resizing the #fancybox-wrap and #fancybox-inner elements. After some very quick checking, it looks like #fancybox-wrap is set to 20px wider than #fancybox-inner:

$('#fancybox-inner').width(400);
$('#fancybox-wrap').width(420);

You can also control the width when you first register fancybox using the width option:

$('#somelink').fancybox({ width: '100px' });
like image 122
TM. Avatar answered Sep 30 '22 12:09

TM.