我无法控制 iOS 中 iframe 的大小。里面的内容好像把整个iframe都展开了。我已经使用 css 和 javascript 来控制大小但没有成功。
这两个我都试过了:
iframe {
height:100px !important;
width:100px !important;
}
$('iframe).css({'height':'100px'});
最佳答案
.video-container iframe {
position: absolute;
top:0;
left: 0;
width: 100%;
height: 100%;
}
要使嵌入的内容具有响应性,您需要在 iframe 周围添加一个包含包装器。您的标记如下:
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 35px;
height: 0;
overflow: hidden;
}
<div class="video-container">
<iframe src="http://www.youtube.com/embed/4aQwT3n2c1Q" height="315" width="560" allowfullscreen="" frameborder="0">
</iframe>
</div>
关于javascript - iOS safari 会自动扩展 iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47223285/