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:46

With iframe

   $(document).ready(function () {
        $(".fancybox").fancybox({
            width:600,
            height:400,
            type: 'iframe',
            href  : 'url_here'
       });
     })

Without iframe

 $(document).ready(function () {
    $(".fancybox").fancybox({
        width:600,
        height:400,
        autoDimensions: false,
   });
 })
查看更多
何必那么认真
3楼-- · 2020-02-10 23:53

The only way that worked for me was with preload = false on the iframe:

$("[data-fancybox]").fancybox({
    iframe : {
        css : {
            height : '1000px',
        },
        preload : false
    },
});
查看更多
家丑人穷心不美
4楼-- · 2020-02-10 23:54

Hey Use code given below:

fancybox({
    afterLoad  : function () {
        $.extend(this, {
            aspectRatio : false,
            type    : 'html',
            width   : '90%',
            height  : '90%',
            content : '<div class="fancybox-image" style="background-image:url(' + this.href + '); background-size: cover; background-position:50% 50%;background-repeat:no-repeat;height:100%;width:100%;" /></div>'
        });
    }
});
查看更多
SAY GOODBYE
5楼-- · 2020-02-10 23:58
jQuery(function($){     
            $(document).ready(function() {
        $("#lightwindow").fancybox({
                    minWidth: 250,
                    width: 250,
                    minHeight: 500,
                    height: 500,
                    'autoScale': false,
                    'autoDimensions': false,
                    'scrolling'     : 'no',
                    'transitionIn'  : 'none',
                    'transitionOut' : 'none',
                    'type': 'iframe'                   
                });
            });
        });
查看更多
Luminary・发光体
6楼-- · 2020-02-11 00:00

Try:

 $(document).ready(function () {
    $(".fancybox").fancybox({"width":400,"height":300});
 })
查看更多
登录 后发表回答