移动端向上滑动整个屏幕

it2026-02-06  1

监听touchStart,touchEnd,使用jquery的animate touchStart(e) { console.log("开始"); this.startY = e.targetTouches[0].clientY; }, touchEnd(e) { // e.preventDefault(); let y = Math.abs(this.startY - e.changedTouches[0].clientY) > 30; console.log("结束:" + y); if (y) { $("html,body").animate( { scrollTop: 2 * window.innerHeight + 20 * 2 + "px" }, 500 ); } }

转载于:https://www.cnblogs.com/dehuachenyunfei/p/11097536.html

最新回复(0)