JavaScript 监听屏幕滑动事件的JS
//selector:可以为dom对象,也可以为dom对象的id值 //etype:监听的事件类型:up,down,left,right //endFun:事件完毕后的回调方法 var zyEvent = function(selector,etype,endFun){
<script> function log(s){ document.getElementById("contid").innerHTML = s; } var eva = new zyEvent(document,'up',function(){log('向上滑动')}); var evb = new zyEvent(document,'down',function(){log('向下滑动')}); var evc = new zyEvent(document,'left',function(){log('向左滑动')}); var evd = new zyEvent(document,'right',function(){log('向右滑动')}); </script>