html5 ios iframe src,iframe不支持ios的解决办法
iframe直接在iosAPP中运行,可能有问题,解决办法可以参考如下代码案例一#ifram {border: 0;width: 1px;min-width: 100%;*width: 100%;}let ifram = document.getElementById('ifram');if (navigator.userAgent.match(/iPad|iPhone/i)) {let ...
iframe 直接在ios APP中运行,可能有问题,解决办法可以参考如下代码
案例一
#ifram {
border: 0;
width: 1px;
min-width: 100%;
*width: 100%;
}
let ifram = document.getElementById('ifram');
if (navigator.userAgent.match(/iPad|iPhone/i)) {
let iframe_box = document.getElementById('iframe-box');
iframe_box.style.width = 100 + '%';
iframe_box.style.overflowX = 'hidden';
iframe_box.style.overflowY = 'scroll';
iframe_box.style.webkitOverflowScrolling = 'touch';
ifram.setAttribute('scrolling', 'no');
iframe_box.appendChild(ifram)
}
案例二(可以直接在x5中使用)
//js中
var ifram = this.getElementByXid('iframe');
if (navigator.userAgent.match(/iPad|iPhone/i)) {
var cntent = this.getElementByXid("contents1");
cntent.style.width = 100 + '%';
cntent.style.overflowX = 'hidden';
cntent.style.overflowY = 'scroll';
cntent.style.webkitOverflowScrolling = 'touch';
ifram.setAttribute('scrolling', 'no');
cntent.appendChild(ifram)
}
ifram.src=url;
html源码
更多推荐
所有评论(0)