开发者

Fancybox width not applying

开发者 https://www.devze.com 2023-02-09 23:33 出处:网络
Us开发者_StackOverflow中文版ing the following JS the width isn\'t being adjusted.It doesn\'t get adjusted when I use \'750\' or \'750px\'

Us开发者_StackOverflow中文版ing 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


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...


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

Fancybox Documentation


Change _get_zoom_to (on line 690) from

to.width = currentOpts.width + double_padding;

to

to.width = parseInt(currentOpts.width) + parseInt(double_padding);


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);

0

精彩评论

暂无评论...
验证码 换一张
取 消