预定义的手机功能:当我们关注任何输入时,它会自动滚动到移动设备中的该输入。
问题: 它在我的 ionic 应用程序中不起作用,因为水平滚动也在那里,所以当我在移动设备中单击输入时,它不会自动滚动到该输入并且输入隐藏在键盘。
我已经为此尝试了 delegate-handle
,但它不起作用。
Plunker同样的
HTML
<ion-scroll direction="xy" class="scroll" delegate-handle="nomineeDiv">
<div class="table-row" ng-repeat="data in nominee"><!-- Multiple div show horizontally -->
<form name="data.formName">
<!-- Long vertical form
.....
.....
after 4 input tags -->
<input type="text" name="something"/>
<!-- Need to scroll to input when input focused -->
</form>
</div>
</ion-scroll>
Controller
$ionicScrollDelegate.$getByHandle('nomineeDiv').scrollBy(580, 140, true);
最佳答案
Solution.1 你能尝试创建一个双击事件来改变表单的位置吗?这可能会使您的页脚位于顶部。
Solution.2 使用 CSS 应用 overflow-y: scroll;
在表格上。
Solution.3 您也可以尝试删除首选项 <preference name="fullscreen" value="true" />
在 config.xml 文件中。
我遇到了同样的问题,我使用 Solution.2 解决了它。
这是一个链接 -- Keyboard Hiding Inputs Problem
关于html - 专注于手机输入时无法滚动到 ionic 应用程序中输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42648607/