admin管理员组文章数量:1326282
I've been searching around to find out what events are triggered when you scroll on an iPad on webpages.
There is this source: .html
Which indicates the following are fired:
ontouchstart="touchStart(event);"
ontouchmove="touchMove(event);"
ontouchend="touchEnd(event);"
ontouchcancel="touchCancel(event);"
The problem is how to deal with the momentum scrolling when a user flicks to scroll. I think the onsroll event only fires when the scrolling has finished.
Does anyone know if any events are fired when the momentum scrolling is occuring so you can do checks as the page is scrolling under this 'momentum'?
cheers
I've been searching around to find out what events are triggered when you scroll on an iPad on webpages.
There is this source: https://developer.apple./library/safari/#documentation/appleapplications/reference/SafariWebContent/HandlingEvents/HandlingEvents.html
Which indicates the following are fired:
ontouchstart="touchStart(event);"
ontouchmove="touchMove(event);"
ontouchend="touchEnd(event);"
ontouchcancel="touchCancel(event);"
The problem is how to deal with the momentum scrolling when a user flicks to scroll. I think the onsroll event only fires when the scrolling has finished.
Does anyone know if any events are fired when the momentum scrolling is occuring so you can do checks as the page is scrolling under this 'momentum'?
cheers
Share Improve this question asked Jan 24, 2013 at 12:19 SamSam 2,4372 gold badges23 silver badges26 bronze badges 3-
3
Have you checked if the
scroll
event on the window fires during momentum scrolling? Example:$(window).scroll(function(){ console.log('scrolling') });
– Klaas Leussink Commented Jan 24, 2013 at 13:01 - It's currently not possible to open a dev console on an iPad. However, from my limited experience, it does not fire when the window is momentum scrolling. – d_rail Commented Oct 22, 2015 at 21:11
- You can use Safari Web Inspector to debug Safari on iOS. This capability has been around for a while. – bvpb Commented Nov 1, 2017 at 1:12
2 Answers
Reset to default 2The problem is that on an iPad the scroll does not continuously fires. It only fires once when you stop scrolling. As far as I know you cannot solve this.
On the desktop this is not the case. Here during scrolling the browser continuously fires the scroll event.
I noticed this behaviour when I was working on a parallax scrolling website. On iOS everything stuttered because the scroll event was only firing once.
However it is possible to simulate as described here: javascript scroll event for iPhone/iPad?
Use this code
document.addEventListener('touchmove', function(e) {console.log('touch move', $(window).scrollTop())}, true);
it fires even during touches.
本文标签: javascriptiPad scrollingwhat events fire during scrollingStack Overflow
版权声明:本文标题:javascript - iPad scrolling - what events fire during scrolling? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742212010a2433885.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论