iScroll

iScroll解决了移动设备上决定定位出现的问题,目前版本iScroll4

但是有个老问题还是在,中间层如果出现输入框,点击时无法取得焦点

解决办法:

http://stackoverflow.com/questions/5745374/iscroll-4-problem-with-form-select-element-iphone-safari-and-android-browser/5769405#5769405 

The problem is that iScroll cancels the default behavior of your select tag (Not a very good implementation if you ask me).

This occurs in the _start() function on line 195:

e.preventDefault();

If you comment that out you'll notice the select tag works again.

But commenting it out means you've hacked the library which might break other desirable iScroll functionality. So here's a better workaround:

var selectField = document.getElementById('Field10');
selectField
.addEventListener('touchstart' /*'mousedown'*/, function(e) {
    e
.stopPropagation();
}, false);

That code will allow the default behavior to occur, without propagating the event to iScroll where it screws everything up.

Since your JS is not inside any JQuery-like onReady() event, you'll have to make sure to you put this code AFTER the html where your select elements are defined.

Note that for mobile devices the event is 'touchstart', but for your PC browser it will be 'mousedown' 

原文地址:https://www.cnblogs.com/abinxm/p/2407848.html