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

Mar*_*cus 2 iphone jquery events android scroll

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

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

谢谢

ᴘᴀɴ*_*ᴛɪs 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");

});
Run Code Online (Sandbox Code Playgroud)

  • 实际上,需要注意的是,iOS在滚动开始后不允许任何DOM操作,直到停止为止.所以你不能删除scrollstart上的标题. (3认同)