开发者

Problem adjusting Fancybox iframe overlay width and height

I'm using Fancybox to create an overlay with an iframe everything works but I can't seem to change the values of the width/height. I'm using fancybox-1.2.6 and jquery1.2.6

$(document).ready(function() {

        $("a.iframe").fancybox({
     'width' : '75%',
     'height' : '75%',
     'autoScale' : false,
     'transitionIn' : 'none',
     'transitionOut' : 'none',
     'type' : 'iframe'
});
   开发者_开发问答 });

and

<a class="iframe" id="iframe" title="Sample title" href="http://google.com/">iframe</a>


Here's how to manually open an iframe in a fixed sized fancybox

$.fancybox.open({
  'href': 'mypage.html',
  'type': 'iframe',
  'autoSize': false,
  'width': 800,
  'height': 800
}); 


you have to directly change the css of it since fancybox isnt actually part of jquery.

$("#fancybox").css({'width': '500px', 'height': '500px'}); 

there is that way or something like this,

jQuery(document).ready(function() {
$.fancybox(
    {
        'autoDimensions'    : false,
        'width'             : 350,
        'height'            : 'auto',
        'transitionIn'      : 'none',
        'transitionOut'     : 'none'
    }
);
});


I solved this problem by adding a width and a height attribute to the link tag like this:

<a id="various3" href="action.html" width="60%" height="60%">Iframe</a>

And you fancybox code:

$("#popup").fancybox({
    'autoScale'     : false,
    'width'         : $("a#popup").attr("width"),
    'height'        : $("a#popup").attr("height"),
    'transitionIn'  : 'elastic',
    'transitionOut' : 'elastic',
    'type'          : 'iframe'
});


Please do not use Firefox. It doesn't work, they did not make height compatible, try chrome instead! (latest Firefox today!) if it is a supportable browser, remove the quotes for px, put quotes for %, like:

'width': 400; //400 pixels;
'width': '75%'; //75% of the screen
//height do not work on Mozilla Firefox (today!)


just try this

    $(".fancyboxiframe").fancybox({
        fitToView:false,
        autoSize:false,
        'width':parseInt($(window).width() * 0.7),
        'height':parseInt($(window).height() * 0.55),
        'autoScale':true,
        'type': 'iframe'
    });


This has worked for me in the past. I had to set both the height and the width.

 $(document).ready(function() {         
    $("a.iframe").fancybox({
                    'autoDimensions'    : false,
                    'width'             : 600,
                    'height'            : 150,
                    'transitionIn'      : 'elastic',
                    'transitionOut'     : 'elastic',
                    'type'              : 'iframe'

                });
    });


try to use:

'maxHeight' : 380,
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜