ftlabs / fastclick

Polyfill to remove click delays on browsers with touch UIs
MIT License
18.66k stars 3.23k forks source link

ios下导致文本框聚焦困难 #582

Open liu-xinhui opened 5 years ago

liu-xinhui commented 5 years ago

需要点击好多次文本框,键盘才会弹出

linking2014 commented 5 years ago

需要点击好多次文本框,键盘才会弹出

这里有篇文章 http://www.php.cn/js-tutorial-387360.html

betterTry commented 5 years ago

可以看下这个commit https://github.com/betterTry/fastclick/commit/342a6641500c40b7167ef7f21439d29fc6e21263

webyuanzheng commented 5 years ago

FastClick.prototype.focus = function (targetElement) { let length; if (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(); } } //加上这段代码完美解决

AntiMoron commented 4 years ago

我能被这个库气死。接手一下很久的项目看了半天 还奇怪为啥、

在contenteditable的div上试了真的有半天的时间都无解

试试注释掉以前的人在公共文件里写的FastClick.attech(body)就好了,

然后才找到本帖save my day.