How to dynamically resize iframes in Fancybox 2?

I am using Fancybox 2.0. I open the content in an iframe. How can I dynamically resize a popup when content in an iframe changes?

I google for hours, but all the links are for either the older version (1.3) or for dead ends.

Thanks for entering!

+5
source share
3 answers

I used the option before showing to resize it:

 beforeShow: function(){
    this.width = $('.fancybox-iframe').contents().find('html').width();
    this.height = $('.fancybox-iframe').contents().find('html').height();
 }

To run this function from within the frame, you need to run the parent element. $. fancybox.update () from the child page, which should resize it.

0
source

iframe , autoSize. autoSize true, autoHeight autoWidth true. , "inline", "ajax" "html" .

$.fancybox.open({
padding : 0,
href:'http://www.gamespot.com',
type: 'iframe',
autoSize: true
});
0

That should do it.

$.fancybox({
  width:600,
  height:300,
  autoResize:false
});
-1
source

All Articles