javascript - Scrolling iframe on iOS causes the page to scroll -
i have application displays iframe user needs able scroll on ipad.
apparently can't scroll iframes , other elements default on ios unless use special -webkit-overflow-scrolling
in css.
so example have following html (based on david walsh's solution here: http://davidwalsh.name/scroll-iframes-ios)
<div class="framecontainer"> <iframe src="./frame.html"></iframe> </div>
and css:
* { margin: 0; padding: 0; border: 0; outline: 0; } html, body { height: 100%; background: #ff0000; } .framecontainer { position: absolute; top: 40px; left: 80px; right: 80px; bottom: 40px; background: #ffffff; overflow: auto; -webkit-overflow-scrolling: touch; /* removes spacing below iframe */ font-size: 0; line-height: 0; } .framecontainer iframe { width: 100%; height: 100%; }
however can cause page (red area) bounce , lose focus of iframe either flicking page (around iframe) or varying speed @ flick (e.g. dragging finger slowly). or tapping on page around iframe.
demo here: http://preview.na-software.co.uk/demo/ipadscroll/
i've tried plugins like: http://www.hakoniemi.net/labs/nonbounce/ prevent page bounce, because it's iframe, still causes page have bounce effect when interacting frame because it's different document level. i've tried bubbling touch events iframe parent level plugin catches it, page can still bounce.
Comments
Post a Comment