问题
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?
回答1:
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!!!
回答2:
i dont know hopely this is useful.
$("yourSelector").fancybox({
'width': 560, //change this value with width u want
'height': 340 //change this value with height u want
});
来源:https://stackoverflow.com/questions/14871722/how-to-change-size-of-popup-box-in-jquery-fancy-box-v2-1-4