Using the following JS the width isn't being adjusted. It doesn't get adjusted when I use '750'
or '750px'
$('a#city-prompt').fancybox({
'width': 750
});
I've posted on the fancybox forums about this and haven't gotten a response
You probably have to set autoSize
to false
:
$('a#city-prompt').fancybox({
'width': 750,
'autoSize': false
});
About width
from the documentation :
Width for content types 'iframe' and 'swf'. Also set for inline content if 'autoDimensions' is set to 'false'
None of the answers here worked for me, but this did the trick:
$.fancybox({
'content':$("#element").html(),
'width':'500',
'autoDimensions':false,
'type':'iframe',
'autoSize':false
});
The 'autoSize':false
was the missing key
Try this. You need to set autoSize
to false
:
$(".fancybox").fancybox({'width':400,
'height':300,
'autoSize' : false});
In Fancybox version 2 and above use 'autoSize':false
Make sure to not include the ' when writing out width in pixels. So instead of
'width' : '100', you should have 'width' : 100,
Hope that helps...
In addition to the other answers, to fix the height issue I changed line 998
from :
to.height = currentOpts.height + double_padding;
to:
to.height = parseInt(currentOpts.height) + parseInt(double_padding);
Change _get_zoom_to
(on line 690) from
to.width = currentOpts.width + double_padding;
to
to.width = parseInt(currentOpts.width) + parseInt(double_padding);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.