layer.open({
type: 2,
content: 'http://sentsin.com' //这里content是一个URL,如果你不想让iframe出现滚动条,你还可以content: ['http://sentsin.com', 'no']
});
前四种方法实验过后,有的样式不合理,有的不管用。
1、是iframe标签加属性:allowtransparency="true"
当allowtransparency为true时iframe里的颜色跟父文档的颜色相同
<iframe src="iframe.html" width="600px" height="500px" allowtransparency="true" ></iframe>
2、改iframe标签样式
.layui-layer-iframe .layui-layer-content {
overflow: visible !important;
}
3、iframe 页面中设置高度,超出高度会有滚动条。不适用不合理。
4、layer.iframeAuto()自适应高度,不管用
layer.iframeAuto(index) - 指定iframe层自适应
调用该方法时,iframe层的高度会重新进行适应
最后采用下面方法解决的,然后再调节样式,具体内容要自己调了。
5、对layui-layer-iframe进行操作
<script>
if(window.parent) {
var pDocument = window.parent.document
if(pDocument.getElementsByClassName('layui-layer-iframe')[0]) {
pDocument.getElementsByClassName('layui-layer-iframe')[0].style.backgroundColor = 'rgba(255,255,255,0)'
pDocument.getElementsByClassName('layui-layer-iframe')[0].style.boxShadow = 'none'
}
}
</script>
6.修改最小高度
<script> setTimeout(function() { parent.$('#' + window.name).css('min-height', '640px') var frame = parent.document.getElementById(window.name) var layNode = frame.parentNode.parentNode layNode.style.backgroundColor = 'rgba(255,255,255,0)' layNode.style.boxShadow = 'none' }, 50) </script>