0

I created a fixed width fancybox defined on the parent page like so:

$('.fancybox').fancybox({
    width: 650
});

I have a link that can be clicked within the iframe that pops up that directs to a new page that is 850px wide. I need the FancyBox to adjust up to that width. How can I do this? I've tried using the autosize:true function but that does not seem to do the job.

Arun
  • 626
  • 10
  • 29
  • Check http://stackoverflow.com/a/10776520/1055987 ... you always would need to set dimensions inside the new iframe though. Then, from within the iframe, you could call the `parent.$.fancybox.update()` method – JFK Jan 25 '13 at 03:38

3 Answers3

1

With jQuery you can do:

$(".fancybox").css({"width" : "850"});

right after your Fancybox call.

Andrew Klatzke
  • 554
  • 2
  • 4
  • 15
1

You could also do this, assuming that the new content has a size set:

$('#fancybox-wrap, #fancybox-outer, #fancybox-content').css('width', 'auto');
$.fancybox.center();
earachefl
  • 1,880
  • 7
  • 31
  • 55
  • 1
    for latest version $('.fancybox-wrap, .fancybox-outer, .fancybox-inner, .fancybox-content').css('width', 'auto'); $.fancybox.reposition(); – Harpreet Bhatia Jun 19 '14 at 11:57
0

You can call:

$('#fancybox-content').width(850);

To resize the width of the fancybox at any time.

Jason Small
  • 1,064
  • 1
  • 13
  • 29