Home  >  Article  >  Web Front-end  >  div内iframe无法自适应宽度_html/css_WEB-ITnose

div内iframe无法自适应宽度_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:36:421481browse

这是我的页面:

div内iframe无法自适应宽度_html/css_WEB-ITnose

图1

图2

最下面的一个id为"frameMap"的iframe无法自适应宽度,如果在外部div指定宽度为100%后,下面这个iframe就看不到了。
当把左边的div隐藏后这个iframe只是位置向左浮动了,宽度并没有自适应。请教


回复讨论(解决方案)

想iframe宽度自适应,最好用JS

想iframe宽度自适应,最好用JS


js要怎么做?iframe不固定宽度看不到,固定宽度后不能拉伸,而且当浏览器变下后也看不到 了 


想iframe宽度自适应,最好用JS


js要怎么做?iframe不固定宽度看不到,固定宽度后不能拉伸,而且当浏览器变下后也看不到 了 

使用jquery方法,假设你的框架iframe的id为theFrame

function setSize(){
$('#theFrame').css("width",$(window).width());
}

//页面加载时设框架款宽度
$(document).ready(function (){
setSize();
}); 
  
//人工拖扯窗口大小时,重设框架款宽度
$(window).resize(function () { 
setSize();
});

我的  http://www.coding99.com/fe/show_48.html 可以看看 互相学习  

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn