iframe content scroll issue
iframe content doesn't scroll properly when touch is initiated, eg, in the center of the content. It will scroll if touch is initiated on the left or right edge of the content. Not sure if this is related to closed issue iframes block scrolling #306 .
I'm using Ionic v1.0.1-beta, Cordova v3.4.1-0.1.0, iOS 7.1 .
eg, I replaced the tab-dash.html content, generated via ionic start myApp tabs, with:
<ion-view title="Dashboard">
<ion-content scroll="true" class="has-header padding">
<h1>Dashboard0</h1>
<iframe src="http://xkcd.com" style="width:100%;height:100%"></iframe>
</ion-content>
</ion-view>
To be honest, we have absolutely no idea about this either. iFrames can be really annoying.
I don't know the answer to either of these questions:
- Why this happens
- If it's possible to fix
Do you have any insight?
May not be an Ionic issue, and may be that iframes need special handling in iOS webkit; 2 semi-fixes ( scrolling can be initiated from within the iframe, but some content is clipped on the left and right sides ). With this, perhaps you can make a final call on whether to close this issue ?
- See alexjeen's comment: https://github.com/fancyapps/fancybox/issues/2
<style>
.iframe-issue {
-webkit-overflow-scrolling: touch !important;
overflow: scroll !important;
}
</style>
<ion-view title="Dashboard">
<ion-content scroll="true" class="has-header padding iframe-issue">
<h1>Dashboard0</h1>
<iframe src="http://xkcd.com" style="width:100%;height:100%"></iframe>
</ion-content>
</ion-view>
- Set ion-content overflow-scroll attribute to "true"
<ion-view title="Dashboard">
<ion-content scroll="true" overflow-scroll="true" class="has-header padding">
<h1>Dashboard00</h1>
<iframe src="http://xkcd.com" style="width:100%;height:100%"></iframe>
</ion-content>
</ion-view>
Hey @pk1u, is this still an issue? Using data-tap-disabled="true" should help.
Seems to be working now. http://codepen.io/perrygovier/pen/eGplD Let me know if that's not the case.
@perrygovier I loaded that codepen in my iPhone, and I can't scroll when I start dragging inside the xkcd frame.
I'm not sure if this bug is about scrolling the content within the iframe, or scrolling the page outside of the iframe.
I hope it is the latter.
For example, if a page has a YouTube video, then I try to scroll the page, initiating the drag on the YouTube video, the page does not scroll.
I share the same problem
+1
+1
I had the same issue and I fixed with this example: https://github.com/alexgzhou/brandNewiCYL/commit/6d877424896394f78e7efaeccbbeddfb72b487a9
CSS:
.iframe-wrapper iframe {
width: 100%;
height: 100%;
}
HTML:
<ion-content scroll="true" overflow-scroll="true" class="iframe-wrapper">
<iframe data-tap-disabled="true" src="{{iframeURL}}"></iframe>
</ion-content>
@JonathanAquino, about the YouTube iframes I guess it's because the video catch the tap event. I recommend you to use directly the video iframe in the correct size, then you don't have to do scroll. This is the full video url: https://www.youtube.com/v/{{videoId}}.
@jorgecasar solution works for me. Thanks!
+1 same issue
+1 I tried the approach from @jorgecasar, but this only shows 30px of the iframe (disqus) and will not be able to resize once the content is loaded.
@Maddis1337, can you post an example throw codepen and post it in the forum? http://forum.ionicframework.com/t/iframe-scroll-bug/196
We need to use Google DFP to place ads in our app. The problem is that DFP/GPT uses iframes to render ads, and when an ad is visible, the user cannot scroll further.
I cannot get this solution to work, an example of the problem can be seen in this codepen. When starting to scroll from within the black iframe, nothing happens. http://codepen.io/anon/pen/bNLqqw
+1 @jorgecasar ! Thank you
This made my day:
<ion-content scroll="true" overflow-scroll="true" class="iframe-wrapper">
<iframe data-tap-disabled="true" src="{{iframeURL}}"></iframe>
</ion-content>
Thank you @jorgecasar your solution solved my problem too.
@jorgecasar :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: :+1: Thank you
Great! Worked very well!
The content doesn't fit on the page the iframe does, but you have to scroll to both sides if there's any content, anybody found a solution to that issue?
overflow-scroll="true"