Updating fancybox size dynamically

Asked

Viewed 655 times

2

Hello,

I need to resize the size of a Fancy box dynamically from an event onClick which 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'

Also, by using this method, when resizing the browser, the Fancybox returns to its initial size.

Is there any way around these problems? I am using version 2.1.5

1 answer

1


You can do it that way:

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

Remembering that for this to work properly you need that in the Fancybox call the attribute autosize be it true

Example:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.