Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix swiper TouchMove to normal page scrolling caused by `preventDef… #298

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dawiwt
Copy link

@dawiwt dawiwt commented May 9, 2019

修复 Swiper handleTouchMove 事件中的 preventDefault 导致页面不能正常滚动的问题。

  1. 在 handleTouchStart 记录起始触摸点
  2. 在 handleTouchMove 中计算横向与纵向触摸移动距离
  3. 分别比较横向与纵向移动距离来判断用户滚动意向,满足当前 direction 才对 diff 求值
  4. 比较 diff 与 translate 来决定是否 preventDefault 并且更新 translate

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 81.029% when pulling 26bda65 on dawiwt:master into f8b12cd on weui:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants