Chrome"模拟触摸事件"无效

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)

Mik*_*itt 12

令我感到困惑的是,除了选中"模拟触摸事件"复选框之外,还必须选中主"启用"复选框以启用覆盖.一旦两个都被检查,它工作正常.

在此输入图像描述