Javascript iphone safari中隐藏的iframe问题
Safari iphone/ipad在iframe上的宽度和高度不采用0px,而是采用大尺寸Javascript iphone safari中隐藏的iframe问题,javascript,html,Javascript,Html,Safari iphone/ipad在iframe上的宽度和高度不采用0px,而是采用大尺寸 除了将display设置为none之外,是否有人看到了这一点或找到了其他修复方法,因为0px似乎在所有浏览器上都能工作。我通过将我能找到的每个参数归零来解决问题: var el = document.createElement("iframe"); el.setAttribute('id', 'yourFrameId'); el.height = 0;el.width = 0; el.hspace="0
除了将display设置为none之外,是否有人看到了这一点或找到了其他修复方法,因为0px似乎在所有浏览器上都能工作。我通过将我能找到的每个参数归零来解决问题:
var el = document.createElement("iframe");
el.setAttribute('id', 'yourFrameId');
el.height = 0;el.width = 0;
el.hspace="0";el.vspace="0";
el.marginheight="0";el.marginwidth="0";
el.frameBorder = "0";el.scrolling = "No";
或内联:
<iframe src="test.html" id="yourFrameId" width="0" marginwidth="0" height="0" marginheight="0" align="top" scrolling="No" frameborder="0" hspace="0" vspace="0">Browser not compatible. </iframe>
浏览器不兼容。
我还在CSS中设置display:none
这让我在iOS上工作。没有在其他移动浏览器上进行过测试,但如果您遇到问题,可以尝试设置位置:绝对、顶部:-9999px等。我通过将所有参数归零来解决问题:
var el = document.createElement("iframe");
el.setAttribute('id', 'yourFrameId');
el.height = 0;el.width = 0;
el.hspace="0";el.vspace="0";
el.marginheight="0";el.marginwidth="0";
el.frameBorder = "0";el.scrolling = "No";
或内联:
<iframe src="test.html" id="yourFrameId" width="0" marginwidth="0" height="0" marginheight="0" align="top" scrolling="No" frameborder="0" hspace="0" vspace="0">Browser not compatible. </iframe>
浏览器不兼容。
我还在CSS中设置display:none
这让我在iOS上工作。还没有在其他移动浏览器上测试过,但如果您有问题,可以尝试设置位置:绝对,顶部:-9999px,等等