我正在尝试使用iscroll5将输入字段放入滚动条。我需要听取输入的focusout()事件,但是在点击其他地方时我从未收到通知。 当我删除滚动条时它可以工作!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<title>iScroll demo: simple</title>
<script type="text/javascript" src="iscroll5.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
var myScroll;
function loaded () {
myScroll = new IScroll('#wrapper', { mouseWheel: true });
$("input").focusout(function(e) {
console.log("input lost focus"); // NEVER GET HERE
});
$("input").click(function(e) {
console.log("input onClick");
});
}
</script>
</head>
<body onload="loaded()">
<div id="header">iScroll</div>
<div id="wrapper">
<div id="scroller">
<ul>
<li>Pretty row 1</li>
<li>Pretty row 2</li>
<li>Pretty row 3</li>
<li>Pretty row 4</li>
<li><input type='text'></li>
<li>Pretty row 6</li>
...............
</ul>
</div>
</div>
<div id="footer"></div>
</body>
</html>
答案 0 :(得分:-2)
尝试将'preventDefault:false'添加到我已经完成的选项中