我正在使用来调整我的iframe的高度到它的内容的高度。到目前为止工作很顺利,我和巫婆只有一个问题。当加载时,它需要屏幕宽度来设置iframe,这对于桌面大小的屏幕来说是可以的,但是对于移动设备,我想允许在x-axe上滚动。有什么建议吗?
下面是我的iframeresize初始化:
if (document.getElementById('iframe')){
$('iframe').iFrameResize({
autoResize: true,
scrolling: false,
maxWidth: screen.width,
sizeWidth: true,
//widthCalculationMethod: 'taggedElement',
checkOrigin: [reports_server],
//log: true
});
}这是我的css:
.iframe-content{
/* min-width: 800px;
min-height: 640px;*/
width: -moz-available;
width: 100% !important;
/*height: 100%;*/
overflow-y: hidden;
}
@media (max-width : 768px) {
.iframe-content{
overflow-x: scroll !important;
}
}以及iframe的html部分:
<iframe title="myiframe" id="iframe" class="iframe-content" src="mysource" scrolling="no"></iframe>发布于 2016-06-17 12:26:00
您可以在iframe中设置最小宽度。
https://github.com/davidjbradshaw/iframe-resizer#minheight--minwidth
https://stackoverflow.com/questions/37668386
复制相似问题