iPad滚动到iframe的顶部 [英] iPad Scrolling to Top of iframe
本文介绍了iPad滚动到iframe的顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尽力在可访问的内容中重新创建它. 我有一个运行ios7的ipad mini,并且正在使用与此类似的东西:
I did my best to recreate this in something accessible. I've got an ipad mini running ios7 and am using something similar to this:
<div id="holder">
<iframe height="100%" width="100%" src="http://www.cnn.com" id="iframe"></iframe>
</div>
#holder {
height:500px;
width:100%;
overflow:scroll;
-webkit-overflow-scrolling: touch;
}
请参阅小提琴: http://jsfiddle.net/khJgY/4/
现在的问题是,在iframe中滚动可以正常工作.但是,如果您更改焦点(例如转到其他HTML/CSS/JS编辑框之一),则iframe会滚动回到左上角,我不知道为什么.
Now the issue is, scrolling in the iframe works fine. But if you change focus (say to one of the other HTML/CSS/JS edit boxes) the iframe scrolls back to the top left and I have no idea why.
任何帮助将不胜感激.
推荐答案
以下CSS为我修复了该问题. (源)
The following CSS fixed it for me. (source)
在内部iframe上:
On the inner iframe:
html, body
{
width: 100%; height: 100%; overflow: auto; -webkit-overflow-scrolling: touch;
}
这篇关于iPad滚动到iframe的顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文