我在使用 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;
}
最佳答案
试试这个,看看它是否会更新。
.mfp-content {
width:300px;
height:300px;
}
关于javascript - Magnific Popup iframe 高度和宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29929265/