<script>
$(document).ready(function(){
$("a").click(function(event){
event.preventDefault();
});
});
/*防止误触,先清除掉浏览器的默认事件 这时候 点击a标签失效不会跳转 手机浏览器的自带滚动条失效*/
document.addEventListener('touchstart',function(e){
//e.preventDefault();
//console.log(e);
});
window.onload = function(){
var Aa = document.querySelectorAll('a');
for(var i=0;i<Aa.length;i++){
Aa[i].addEventListener('touchmove',function(){
this.isMove = true; //给当前元素添加自定义属性isMove 让他等于true; 如果在元素上移动以后就等于true
});
Aa[i].addEventListener('touchend',function(){
if(!this.isMove){ //这里判断 的是如果没有移动的话就是点击。根据当前元素的链接通过window.location.href跳转
window.location.href = this.href;
}
this.isMove = false; //跳转完成以后恢复到false
});
}
}
</script>