宏大弹出窗口iframe的高度和宽度

Mr.*_*wed 5 javascript iframe jquery

我在Magnific Popup上遇到问题,我需要能够使用JavaScript函数在iframe上设置高度和宽度。以下代码对我输入的高度和宽度没有反应,怎么了?

/// Call ////
openmagnificPopup(url, h, w);



/// Java ////

function openmagnificPopup(url, h, w){

   $.magnificPopup.open({
            items: {
            src: url,
            type: 'iframe',

            iframe: {
               markup: '<div style="'+w+'px; height:'+h+'px;">'+
    '<div class="mfp-iframe-scaler" >'+
            '<div class="mfp-close">xxxxxx</div>'+
    '<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
    '</div></div>'
            }

        }


        });


///// CSS /////   
 .mfp-iframe-holder .mfp-content {
    width:auto;
    min-width:300px;
    min-height:300px;
 }
Run Code Online (Sandbox Code Playgroud)

Rob*_*tan 4

试试这个,看看它是否会更新。

.mfp-content {
    width:300px;
    height:300px;
 }
Run Code Online (Sandbox Code Playgroud)