3 回答

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超9個(gè)贊
我需要一個(gè)跨瀏覽器的解決方案。要求是:
需要在iOS和其他地方工作
無法訪問iFrame中的內(nèi)容
需要它滾動(dòng)!
建立我從@Idra學(xué)到的有關(guān)iOS上滾動(dòng)=“否”的內(nèi)容以及關(guān)于在iOS中將iFrame內(nèi)容擬合到屏幕的帖子,這就是我最終的結(jié)果。希望它可以幫助某人=)
HTML
<div id="url-wrapper"></div>
CSS
html, body{
height: 100%;
}
#url-wrapper{
margin-top: 51px;
height: 100%;
}
#url-wrapper iframe{
height: 100%;
width: 100%;
}
#url-wrapper.ios{
overflow-y: auto;
-webkit-overflow-scrolling:touch !important;
height: 100%;
}
#url-wrapper.ios iframe{
height: 100%;
min-width: 100%;
width: 100px;
*width: 100%;
}
JS
function create_iframe(url){
var wrapper = jQuery('#url-wrapper');
if(navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
wrapper.addClass('ios');
var scrolling = 'no';
}else{
var scrolling = 'yes';
}
jQuery('<iframe>', {
src: url,
id: 'url',
frameborder: 0,
scrolling: scrolling
}).appendTo(wrapper);
}
添加回答
舉報(bào)