touchUp(){ var startY = 0; let that = this; document.addEventListener("touchstart",function(e){ startY = e.changedTouches[0].pageY; },false); document.addEventListener("touchmove",function(e){ var endY = e.changedTouches[0].pageY; var changeVal = endY - startY; if(endY < startY){//向上滑 // console.log("向上滑"); that.showSearchFlag = false }else if(endY > startY){//向下滑 // console.log("向下滑"); that.showSearchFlag = true }else{ // console.log("没有偏移"); } // 获取屏幕高度 var a = document.body.scrollTop || document.documentElement.scrollTop;; //滚动条的高度 var b =document.documentElement.clientHeight //可视区的高度 var c = $(‘#listIndex‘).height(); //文档的总高度 if(a+b >= c){ //表示浏览器已经到达最底部 that.showSearchFlag = true } },false); },
原文地址:https://www.cnblogs.com/lst619247/p/11646155.html
时间: 2024-11-10 01:14:08