IFRAMEs and the Safari on the iPad, how can the user scroll the content?
iOS 5 added the following style that can be added to the parent div so that scrolling works.
-webkit-overflow-scrolling:touch
Can't scroll iframe on mobile iOS Safari
Take care of the position Attribute.
<iframe src="www.website.com/" style="position:absolute; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;">
Your browser doesn't support iframes
</iframe>
I set the position to "absolute" and it has fixed it.
*also play with those attributes:
scrolling="no" (or "yes", depends on your need)
overflow: scroll; (or instead of "scroll", use one of those: visible|hidden|auto|initial|inherit;)
iOS Safari - scrolling iFrame causes div underneath to scroll
Just found this post which has a solution which sort of works for me.
You have to have a div wrapping your iframe with the following style
-webkit-overflow-scrolling: touch;
overflow-y: scroll;
as well as positioning styles
Example from that page which is similar to what I got working:
.demo-iframe-holder {
position: fixed;
right: 0;
bottom: 0;
left: 0;
top: 0;
-webkit-overflow-scrolling: touch;
overflow-y: scroll;
}
.demo-iframe-holder iframe {
height: 100%;
width: 100%;
}
It's still a little janky in my case. Sometimes I have to touch something outside of the iframe before I can scroll the iframe again. It seems that if the outer container is still scrolling (eg - if you've just flicked the page and it keeps scrolling for a bit) you can't scroll the iframe. Some of the weirdness I'm seeing may also have to do with the fact that my iframe contains a bunch of form fields.
iOS mobile: scrolling in iFrame within scroll-able parent
Place your <iframe>
s in wrappers with -webkit-overflow-scrolling: touch;
.iContainer {
-webkit-overflow-scrolling: touch;
}
#outside { height: 400px; width: 200px; background: blue; overflow: scroll;}
.space { height: 200px; width: 200px; background: red;}
iframe { height: 1000px; width: 200px; background-color: green; border: none; display:block;}
iContainer { -webkit-overflow-scrolling: touch;}
The green section is the iFrame.... Scrolling on the green section in iOS mobile is the issue
<div id="outside"> <div class="space"></div> <div class="iContainer"> <iframe> </iframe> </div> <div class="space"></div></div>
Related Topics
Is <Input> Well Formed Without a <Form>
Difference Between Width:100% and Width:100Vw
Base64 Png Data to HTML5 Canvas
Document.Body.Scrolltop Is Always 0 in Ie Even When Scrolling
What Is It When a Link Has a Pound "#" Sign in It
How to Make Scrollable Table with Fixed Headers Using CSS
Required Attribute Not Work in Safari Browser
How to Print Background Images in Ff or Ie
How to Set the Max-Width of a Table Cell Using Percentages
Localization of Input Type Number
Align Labels in Form Next to Input
Expand Div to Max Width When Float:Left Is Set