Nat*_*end 8 mobile google-chrome touch touch-event google-chrome-devtools
我在Chrome的开发人员工具中启用了"模拟触摸事件"选项.我设置了一个简单的测试程序,当我触摸时会发出警报<div>.该程序在我的Galaxy Nexus上工作正常,但是当我点击<div>Chrome时,即使启用了"模拟触摸事件"选项,也没有任何反应.有什么建议?我正确使用此工具吗?
这是我的代码 - 没什么太花哨的.
<!DOCTYPE html>
<html lang="en">
<head>
<style type="text/css">
#main_div
{
position: absolute;
width: 50px;
height: 20px;
background-color: red;
top: 50%;
left: 20px;
}
</style>
<script type="text/javascript">
function init()
{
main_div = document.getElementById("main_div");
main_div.ontouchstart = function()
{
alert("here");
}
}
</script>
</head>
<body onload="init()">
<div>
<p id="x">hello</p>
<p id="y"></p>
</div>
<div id="main_div">
hello
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25159 次 |
| 最近记录: |