Attached is a fiddle for a concept input similar to that found on the iPhone. Uses a library called iScroll4 that works on everything except IE.
I have tested IE 8 and IE 9 and both do not work. 开发者_Python百科Here is a fiddle that will work Firefox, Chrome, Safari and touchscreen mobile devices.
http://jsfiddle.net/XHPYF/
Can any one solve it?
iScroll have this problem for a long time. You need to update iScroll code manually to get it fixed. zyrex solution is Ok but can be better:
if(!document.addEventListener) {
document.attachEvent('touchmove,', function (e) {
e.preventDefault();
}, false);
document.attachEvent('DOMContentLoaded', loaded, false);
}
else {
document.addEventListener('touchmove', function (e) {
e.preventDefault();
}, false);
document.addEventListener('DOMContentLoaded', loaded, false);
}
What do you mean with 'do not work in IE'?
I encountered a problem, that my complete page does not load in IE when using iScroll. The error occured in eventListener.
I fixed it by switching the event listener if IE <= Version 8. And it worked.
if(getInternetExplorerVersion() != '-1' && getInternetExplorerVersion() <= '8') {
document.attachEvent('touchmove,', function (e) {
e.preventDefault();
}, false);
document.attachEvent('DOMContentLoaded', loaded, false);
}
else {
document.addEventListener('touchmove', function (e) {
e.preventDefault();
}, false);
document.addEventListener('DOMContentLoaded', loaded, false);
}
精彩评论