fastclick导致点击不灵敏的解决办法

can not bring up keyboard instantly in ios 11.3

FastClick.prototype.focus = function(targetElement) {
var length;
// Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {
length = targetElement.value.length;
targetElement.focus();
targetElement.setSelectionRange(length, length);
} else {
targetElement.focus();
}
};

在这个原型方法下 加入 targetElement.focus();


作者:YZluo_286
来源:CSDN
原文:https://blog.csdn.net/xz370057448/article/details/82842774?utm_source=copy
版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(fastclick导致点击不灵敏的解决办法)