如何在iPhone / Android上捕获滚动启动事件

时间:2011-10-24 17:30:22

标签: jquery android iphone events scroll

我正在使用JQuery与移动网站在没有位置的情况下重新定位滚动页面导航:固定支持。这种方法很好,当用户停止滚动时,标题会放回到页面顶部。

为了增强用户体验,我想隐藏()用户启动滚动时的标题,然后在停止时将其滑入。问题是滚动事件仅在用户停止滚动时触发。我已经读过有iOS特定的触摸事件,但有没有什么方法可以使用相互通用的代码在iOS和Android上捕获滚动启动事件?

由于

3 个答案:

答案 0 :(得分:5)

我相信jQuery Mobile,可以做到这一点。看看下面的代码:

$(document).bind("scrollstop", function() {

//What occurs when the scrolling stops
alert("You have stopped scrolling");
});

$(document).bind("scrollstart", function() {

//What occurs when the scrolling starts
alert("You have started scrolling");

});

答案 1 :(得分:2)

你可以从jQuery Touchwipe开始:它是一个添加新事件,wipeleft和wiperight的插件。

可以轻松修改以将水平划像更改为垂直划线(将x更改为y) http://plugins.jquery.com/project/Touchwipe-iPhone-iPad-wipe-gesture

适用于Android,IOS和BBOS。

答案 2 :(得分:2)

这个scrollstart事件在android 2.3.4的默认android浏览器中出错。当用户启动滚动时,scrollstart事件不会100%触发。我试图追查问题。我正在寻找在scrollstart事件之前触发的任何事件。它也可能是我的代码中的某个冲突事件。我需要先排除它。