Updating the size of the fancybox dynamically

2

Hello,

I need to resize the size of a fancy box dynamically from a onClick event that will show other components on the page.

I tried to use the following code snippet found here , and this resizes the page but gives the following error, in addition to not centralizing the fancybox on the page.

  

Uncaught TypeError: Object function () {b.open.apply (this, arguments)}   has no method 'center'

In addition, by using this method, by resizing the browser, Fancybox returns to its initial size.

Is there any way to get around these issues? I'm using version 2.1.5

    
asked by anonymous 20.03.2014 / 16:00

1 answer

1

You can do it this way:

$("#seuBotao").click(function () {
        parent.$fancybox.update();
});

Remembering that for this to work correctly you need the autosize attribute in the FancyBox call to be true

Example:

$("#fancy").fancybox({
        width: 750,
        height: 550,
        autoSize: true
});
    
20.03.2014 / 19:27