<script type="text/javascript">$(function(){ $("body").on("touchstart", function(e) { e.preventDefault(); startX = e.originalEvent.changedTouches[0].pageX, startY = e.originalEvent.changedTouches[0].pageY; }); var s=1; $("body").on("touchmove", function(e) { e.preventDefault(); moveEndX = e.originalEvent.changedTouches[0].pageX, moveEndY = e.originalEvent.changedTouches[0].pageY, X = moveEndX - startX, Y = moveEndY - startY; if ( Math.abs(Y) > Math.abs(X) && Y>0){ s--; console.log(s); // console.log("top到bottom"); } else if ( Math.abs(Y) > Math.abs(X) && Y<0){ s++; console.log(s); // console.log("bottom到top"); } else{ console.log("return"); return; } });})</script>
添加回答
举报
0/150
提交
取消