首页 > 解决方案 > 在 iframe 中填写表单时 iOS 中的问题

问题描述

我有一个包含表单的 iframe。在台式机和安卓设备以及 iPad 上一切正常。但在 iphone 8+ 和 iphone 7、iOS - 11.3 的情况下,当我开始在此 iframe 中的任何字段(文本字段或文本区域)内输入时,页面会自动滚动到底部,因此用户无法看到他/她在字段中输入的数据。iOS 中的 Safari 和 chrome 都会发生这种情况。iframe 初始化如下:

<iframe ng-src="myUrl" ng-if="model.seat.survey_url" width="100%" height="100%" border="0" style="border-style: none; height:100%;overflow:hidden;width: 100%;" scrolling="no"></iframe>

这个 iframe 在 bootstrap modal 中加载,并且已经使用了 angularjs。

标签: iosiframescrolliphone-8-plus

解决方案


如果可以,请尝试将以下 CSS 添加到父页面,它为我解决了同样的问题。

html, body {
   height: 100%;
   overflow: auto;
   -webkit-overflow-scrolling: touch;
}

推荐阅读