最近 用zepto写了个h5的页面 然后 用阻止默认的滑动事件

$(document).on("touchstart",function(ev){
ev.preventDefault();
})

接下来 所有定位在 页面元素的 click事件 都会失效 ?暂未知所以然  留待解决的问题

<!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>
View Code

 

posted on 2016-03-01 14:46  Tadini  阅读(176)  评论(0编辑  收藏  举报