Search code examples
jqueryhtmlcsspopupfancybox

How to change size of popup box in jquery fancy box v2.1.4?


I am using jquery fancy-box v2.1.4 (see the fancybox website here). Fancybox is working fine, but I am having trouble changing the size of pop up window. How can I control the size of the fancybox popup window?


Solution

  • FancyBox as built in method to set width and height to the "window" generated to hold the content... check the website for further instructions, but here's a hit:

    // initialize popup iframe (fancybox)
    $(".yourframeclass").fancybox({
    'autoDimensions': false,
    'padding'       : 0,
    'width'         : 940,
    'height'        : 400,
    'autoScale'     : false,
    'transitionIn'  : 'none',
    'transitionOut' : 'none',
     'type'          : 'iframe'
     });
    

    Here I'm setting a popup with fixed 940px by 400px (it can be % values as well)... and if the content is larger then the fancybox holder, it will generate scroll bars on that same holder and not on the document itself!!!