移动端使用isscroll.js input无法获取焦点(就是点了没反应啦!)

有幸网上找到了解决的办法

只要在代码里加入以下一段代码就可以了

function allowFormsInIscroll(){
 [].slice.call(document.querySelectorAll('input, select, button')).forEach(function(el){
 el.addEventListener(('ontouchstart' in window)?'touchstart':'mousedown', function(e){
 e.stopPropagation();
 
 })
 })
 }
 document.addEventListener('DOMContentLoaded', allowFormsInIscroll, false);

 问题原因是:iscroll需要一直监听用户的touch操作,以便灵敏的做出对应效果,所以它把其余的默认事件屏蔽了。

以上代码原理是:页面加载完成后查找到所有的'input, select, button'元素并依次绑定'touchstart'或'mousedown'事件,在执行事件的时候停止事件的传播,这样行了。

原作者地址:http://www.cnblogs.com/duanhuajian/archive/2012/11/09/2763159.html

原文地址:https://www.cnblogs.com/wenb/p/7522097.html