admin管理员组文章数量:1421732
Any idea why no matter what height i assign to the iframe, it doesn't resize? I'm testing this on an iPhone (on desktop browser it resizes correctly).
<iframe width="320" height="180" src="" frameborder="0"></iframe>
Any idea why no matter what height i assign to the iframe, it doesn't resize? I'm testing this on an iPhone (on desktop browser it resizes correctly).
<iframe width="320" height="180" src="http://www.youtube./embed/wwbKu0mznf4" frameborder="0"></iframe>
Share
Improve this question
edited Apr 3, 2011 at 13:18
Black Frog
11.7k1 gold badge37 silver badges66 bronze badges
asked Apr 3, 2011 at 11:50
deniciodenicio
5621 gold badge7 silver badges22 bronze badges
3 Answers
Reset to default 5Try adding scrolling="no".
<iframe scrolling="no" src="..." width="320" height="180"></iframe>
When you rewrite the height with javascript use a %. Not sure why but it seems to be the only thing that works. A good number to start with is height="20%"
Here is what I've been using.
/* patch Ipad Youtube */
var agent = navigator.userAgent.toLowerCase();
var patchApple = (agent.indexOf('iphone')!=-1) || (agent.indexOf('ipad')!=-1);
if (patchApple) { $('iframe').css({ 'height':'20%' }); }
iPhone doesn't support iframe height attribute. Try putting the iFrame in a div like this:
.scroll {
height:200px;
width:200px;
overflow:auto;
}
<div class="scroll">content</div>
本文标签: javascriptiPhone YouTube embed with iframeStack Overflow
版权声明:本文标题:javascript - iPhone YouTube embed with iframe - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745332250a2653870.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论