iOS输入专注于点击

时间:2015-09-14 14:33:18

标签: ios mobile web tap

如你所知,iOS上有300毫秒延迟&#34;点击&#34;事件,这就是为什么移动开发者使用不同的库来实现&#34; tap&#34;没有延迟的事件(我使用tap.js)。但是当您点击/点击<input type="text" />元素时,焦点前仍有300毫秒的延迟。那么,有没有人知道如何专注于点击输入,而不是点击?

1 个答案:

答案 0 :(得分:0)

您必须手动禁用本机行为并强制执行焦点事件

示例:

$('input').on('touchstart', function(e){
     e.preventDefault();
     e.stopPropagation();
     $(this).trigger('focus');
});

就是这样。