javascript - Using zepto's tap event, click once to trigger 2 times. If you click quickly, the error "trigger" undefined will be reported?
三叔
三叔 2017-06-12 09:22:26
0
1
1121

After testing, this problem will appear under chrome, but not under firefox. It may be a compatibility issue.

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>手机端touch事件测试</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <script type="text/javascript" src="js/zepto/zepto.min.js"></script>
    <script type="text/javascript" src="js/zepto/touch.js"></script>

<style>
.pBox{
    width: 100px;
    height: 100px;
    background: red;
    margin: 100px;
}
</style>
</head>
<body>
<p class="pBox">123</p>

<script type="text/javascript">
 $(".pBox").tap(function(){
        console.log(6);
});
</script>
</body>
</html>
三叔
三叔

reply all(1)
曾经蜡笔没有小新

Does your zepto.min.js already contain the touch module? You can use Zepto Builder to repackage it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template