Zepto swipe 無效(坑)

Zepto 滑動插件 bug

Zepto 的 'swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown' 觸摸事件在安卓4.4系統中除chrome + 火狐 以外的 瀏覽器 + 微信 都無效javascript

zepto 滑動插件有bug的。。。html

並且這個 bug 做者不肯意修,理由是:我特麼沒有安卓設備java

I also can't get all about 'swipe' to work correctly on Android devices. I use a Nexus 4 ,xiaomi 1S 。android

Zepto 官方 issuesgit

初步解決方案github

百度 GMU上拉滑動實例頁面chrome

Fix

https://github.com/madrobby/zepto/issues/315#issuecomment-8386027瀏覽器

touch.js微信

.on('touchmove MSPointerMove pointermove', function(e){ if((_isPointerType = isPointerEventType(e, 'move')) && !isPrimaryTouch(e)) return firstTouch = _isPointerType ? e : e.touches[0] cancelLongTap() touch.x2 = firstTouch.pageX touch.y2 = firstTouch.pageY deltaX += Math.abs(touch.x1 - touch.x2) deltaY += Math.abs(touch.y1 - touch.y2) /** * 修復 android 4.4 swipe 事件 * https://github.com/madrobby/zepto/issues/315#issuecomment-8386027 */ if (touch.x2 && Math.abs(touch.x1 - touch.x2) > 10) e.preventDefault() }) 
相關文章
相關標籤/搜索