最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Touch events only firing "once" during scroll in Mobile Safari on iPad iOS 11.4 - Stack Overflow

programmeradmin3浏览0评论

While scrolling in Mobile Safari, the first touchstart, touchmove, and touchend events are fired, however, if you're still scrolling additional touch events are not fired.

For my application this is problematic because a user can stop the scroll with their finger and I can't tell if there is a finger down. When a finger is down you can't set scrollTop of the window or rather you can set it, and it changes, but the window doesn't scroll. When the user moves their finger again it starts scrolling not from where I set the scrollTop but to whether their finger was put down.

Please no ments on why I want to change the scrollTop of the window; let's just accept that as an a priority requirement. Any thoughts for how to detect if there is a finger down?

While scrolling in Mobile Safari, the first touchstart, touchmove, and touchend events are fired, however, if you're still scrolling additional touch events are not fired.

For my application this is problematic because a user can stop the scroll with their finger and I can't tell if there is a finger down. When a finger is down you can't set scrollTop of the window or rather you can set it, and it changes, but the window doesn't scroll. When the user moves their finger again it starts scrolling not from where I set the scrollTop but to whether their finger was put down.

Please no ments on why I want to change the scrollTop of the window; let's just accept that as an a priority requirement. Any thoughts for how to detect if there is a finger down?

Share Improve this question edited Jul 5, 2018 at 12:26 user7637745 9852 gold badges14 silver badges27 bronze badges asked Jun 11, 2018 at 17:16 overgrooveovergroove 9781 gold badge7 silver badges16 bronze badges 2
  • 5 Your question is not getting enough coverage because you have not added any source code. Better to add source code snippet and explain problem accordingly. – Vikasdeep Singh Commented Jun 15, 2018 at 7:29
  • @VicJordan correctly said, refer this page - stackoverflow./help/how-to-ask – Ramkumar Paulraj Commented Jun 21, 2018 at 5:13
Add a ment  | 

2 Answers 2

Reset to default 1

how about using "detect click on mousedown" like technic? something like:

var touchStart = false;

function onTouchStart() {
   touchStart = true;
}
function onTouchEnd() {
   touchStart = false;
}
function someFunction() {
   if (touchStart) ...;
   else ...;
}

You cannot handle touch events when iOs momentum scrolling is active. This also prevents developers from disabling iOs zoom.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论