最近 用zepto寫了個h5的頁面 而後 用阻止默認的滑動事件html
$(document).on("touchstart",function(ev){
ev.preventDefault();
})web
接下來 全部定位在 頁面元素的 click事件 都會失效 ?暫未知因此然 留待解決的問題chrome
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Examples</title> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <link href="" rel="stylesheet"> <style> *{margin:0;padding:0;} #wrap{width:100%;height: 100%;position: relative;background: rgb(246, 46, 7);} body,html{width:100%;height: 100%;overflow: hidden;} #go{margin: auto;position: absolute;top:0;left:0;right:0;bottom:0;display:block;width:42.63%;height: 20%;text-align: center;display: block;background-image:-webkit-linear-gradient(top,#fffee6,#fff9d7 23%,#fff0c0 40%,#ffecb3 60%,#ffde8d 86%,#ffdd89);-webkit-box-shadow: 4px 4px 4px rgba(0,0,0,.25);box-shadow: 4px 4px 4px rgba(0,0,0,.25); color:#611b04;font-size: 25px;border:none;} </style> </head> <body> <div id="wrap"> <button id="go">go</button> </div> <script src='zepto.min.js'></script> <script> ;(function($){ $(document).on('touchstart',function(ev){ ev.preventDefault(); }) /* document.ontouchstart = function(ev){ ev.preventDefault(); }*/ document.getElementById("go").onclick = function(){ alert(0) } })(Zepto) </script> </body> </html>