javascript - Events for Inertial Scrolling on Mobile Safari - Stack Overflow

I am currently using overflow:scroll on a web page optimized for the iPad, and it works great.I began

I am currently using overflow:scroll on a web page optimized for the iPad, and it works great. I began running into trouble with touch events on the items in the scrolling div, because it was interpreting the scrolling swipes as touches. Since there is no scroll plete event, and the scroll event fires each time you scroll, I tried detecting the scroll event and setting a timer to disable the touch event temporarily. However, I have discovered that the scroll event only fires each time the user initiates a scroll, which is rarely with inertial scrolling.

Is there a constantly firing scroll event or some other way to detect that scrolling is currently happening?

This is only a problem with inertial scrolling on Mobile Safari, because when you move your mouse on OS X, inertial scrolling automatically stops, so to initiate the click event, you would generally need to move the mouse, thus avoiding a conflict. You also don't have the dual use input of touch for scrolling and touch for tapping.

I am currently using overflow:scroll on a web page optimized for the iPad, and it works great. I began running into trouble with touch events on the items in the scrolling div, because it was interpreting the scrolling swipes as touches. Since there is no scroll plete event, and the scroll event fires each time you scroll, I tried detecting the scroll event and setting a timer to disable the touch event temporarily. However, I have discovered that the scroll event only fires each time the user initiates a scroll, which is rarely with inertial scrolling.

Is there a constantly firing scroll event or some other way to detect that scrolling is currently happening?

This is only a problem with inertial scrolling on Mobile Safari, because when you move your mouse on OS X, inertial scrolling automatically stops, so to initiate the click event, you would generally need to move the mouse, thus avoiding a conflict. You also don't have the dual use input of touch for scrolling and touch for tapping.

Share Improve this question asked Mar 22, 2012 at 21:18 Adrian Harris CrowneAdrian Harris Crowne 1,3652 gold badges12 silver badges11 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3
<script type="text/javascript">
<!--
    document.addEventListener("touchmove", ScrollStart, false);
    document.addEventListener("scroll", Scroll, false);
    function ScrollStart() {
        //start of scroll event for iOS
    }
    function Scroll() {
        //end of scroll event for iOS
        //and
        //start/end of scroll event for other browsers
    }   
// -->
</script>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745135168a4613165.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信