例如:
var html = "<div><div style=\"padding:10px;\"><div id=\"divQRCode\"></div></div></div>"; var url = "dsds; layer.open({ type: 1, title: false, shadeClose: true, content: html, success: function (layero, index) { var qrcode = new QRCode('divQRCode', { correctLevel: QRCode.CorrectLevel.L, width: 210, height: 210 }); qrcode.makeCode(url); } });
紧这样弹出层不居中。
给内层html添加固定高度就行了 #divQRCode { width:210px;height:210px; }