Javascript 当我在离子内容中使用 iframe 时,离子内容滚动不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28174609/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
when I use iframe in ion-content, the ion-content scroll is not working
提问by Aaron
<ion-view view-title="title">
<ion-content scroll="true">
<iframe src="{{link}}"></iframe>
</ion-content>
</ion-view>
look at the code above.
看看上面的代码。
as the title says,when I use a iframe in the ion-content the scroll does't work.
正如标题所说,当我在离子内容中使用 iframe 时,滚动不起作用。
How to solve this problem.
如何解决这个问题呢。
采纳答案by Aaron
It's a bug on ios. I have resolved this problem. Refer to the following
这是ios的一个bug。我已经解决了这个问题。参考以下
回答by iDeekshith
Use overflow-scroll to enable scrolling
使用 overflow-scroll 启用滚动
<ion-view view-title="title">
<ion-content overflow-scroll="true">
<iframe src="{{link}}"></iframe>
</ion-content>
</ion-view>
回答by Lasithds
Add the following css to the parent div of iframe
将以下css添加到iframe的父div
-webkit-overflow-scrolling: touch !important;
overflow: scroll !important;
Exmaple:
例子:
HTML
HTML
<ion-content class="iframe-fix">
<iframe [src]="pageUrl" frameborder="0"></iframe>
</ion-content>
SCSS
社会保障局
.platform-ios{
.iframe-fix{
-webkit-overflow-scrolling: touch !important;
overflow: scroll !important;
}
}
回答by Naresh Kumar
<ion-view title="sample page">
<ion-content>
<iframe src="http://www.w3schools.com">
<p>Your browser does not support iframes.</p>
</iframe>
</ion-content>
<ion-view>
it will work scroll option is default true.no need to add specifically
它将工作滚动选项默认为true。无需专门添加

