using fancybox set height and width

2020-02-10 23:19发布

i am new to j query, it is cool, but i am glued to the ceiling on how to add width and height to a iframe generated after click, using this code: all suggestions would be great and thanks in advance Khadija

$(document).ready(function () {
    $(".fancybox").fancybox();
 })
 .height = '600px';

11条回答
疯言疯语
2楼-- · 2020-02-10 23:33

You Need to set autoSize to false, worked for me

$(".fancybox").fancybox({'width':400, 'height':300, 'autoSize' : false});

查看更多
虎瘦雄心在
3楼-- · 2020-02-10 23:33

use this css :)

.fancybox-overlay .fancybox-skin {
   max-width: 900px !important;
   margin: auto;
}

.fancybox-overlay .fancybox-inner {
  max-width: 900px;
  margin: auto;
}

.fancybox-overlay .fancybox-skin {
   margin: auto;
}
查看更多
ら.Afraid
4楼-- · 2020-02-10 23:37

This code set size of fancy dynamic @ run time only you have to pass height & width along with page url,to whom you want to set

Eg: demo.aspx //this statement calls fancy function which is present in your main page

       window.parent.SetFancySizeDynamic(YourPageUrl,300,200)

  MainPage.aspx

// just add this function in your main page

    function SetFancySizeDynamic(fbHref, fbWidth, fbHeight) {

        $.fancybox({
            'padding': 0,
            'overlayColor': '#ccc',
            'type': 'iframe',
            'href': fbHref,
            'width': fbWidth,
            'height': fbHeight

        });
    }
查看更多
我欲成王,谁敢阻挡
5楼-- · 2020-02-10 23:41

If you have still issues

            width      = current.width,
            height     = current.height,

modify it in jquery.fancybox.js

查看更多
成全新的幸福
6楼-- · 2020-02-10 23:46

You must set autoSize to false

$(".fancybox").fancybox({'width':400,
                         'height':300,
                         'autoSize' : false});
查看更多
乱世女痞
7楼-- · 2020-02-10 23:46

To initialize the fancybox popup for the usage of an iframe, limited to a certain width and height, you need at least three parameters:

jQuery

$(document).ready(function(){ 
  $(".fancybox").fancybox({
    'width'  : 600,           // set the width
    'height' : 600,           // set the height
    'type'   : 'iframe'       // tell the script to create an iframe
  });
}); 

You can read all about the available options at the FancyBox API Page.

查看更多
登录 后发表回答