admin管理员组文章数量:1355617
I have an iframe I need to pull in for display on iOS devices. The contents of the iframe are not under my control and they are not responsive in any way (fixed 800x600). So I'd like to scale the iframe down to display it in the iOS viewport.
Using -webkit-transform: scale(0.4)
I was able to scale it down but now the touch events are all wrong (e.g. touch a form element doesn't pop open the keyboard). If you touch where the element was before scaling it works.
Is there any way to correct the offset for touch events?
I have an iframe I need to pull in for display on iOS devices. The contents of the iframe are not under my control and they are not responsive in any way (fixed 800x600). So I'd like to scale the iframe down to display it in the iOS viewport.
Using -webkit-transform: scale(0.4)
I was able to scale it down but now the touch events are all wrong (e.g. touch a form element doesn't pop open the keyboard). If you touch where the element was before scaling it works.
Is there any way to correct the offset for touch events?
Share Improve this question asked Aug 9, 2013 at 22:54 jckdnk111jckdnk111 2,3885 gold badges33 silver badges43 bronze badges 2- Hey jckdnk111, did you ever resolve this issue? I'm looking into this now. Can you update with an answer if you resolved it? – djburdick Commented Sep 24, 2013 at 19:01
- 1 I never solved it. In the end I had ask the owner of the iframe URL to create a postMessage API so I could ask the page to scale itself down (e.g. using a transform on the body of the document in the iframe). It is hacky but it works -- if you can't ask the iframe page to scale itself then I'm afraid you might just be out of luck. – jckdnk111 Commented Sep 25, 2013 at 1:41
1 Answer
Reset to default 7 +25Opt for scale3d
instead of scale
. In my experience, transforming elements that need to be responsive was better achieved when the element was pushed into the accelerated stack.
Markup
<iframe src="http://wikipedia" width="200" height="200"/>
CSS
iframe {
-webkit-transform-style: preserve-3d;
-webkit-transform: scale3d(0.4,0.4,0.4);
}
Fiddle: http://jsfiddle/gyHR6/
More about -webkit-transform-style
here:
https://www.webkit/blog-files/3d-transforms/transform-style.html
本文标签: javascriptiOS css webkittransform scale doesn39t offset touch eventsStack Overflow
版权声明:本文标题:javascript - iOS css -webkit-transform: scale doesn't offset touch events - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743936496a2564778.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论