如何在iPhone / Android上捕获滚动启动事件 [英] How to capture scroll start event on iPhone/Android

查看:104
本文介绍了如何在iPhone / Android上捕获滚动启动事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using JQuery with a mobile site to reposition the header nav on scroll in the absence of position:fixed support. That works fine, when the user stops scrolling the header is placed back at the top of the page.

为了增强用户的体验,我想隐藏()当用户开始滚动,然后在停止时将其滑入,标题。问题是滚动事件只在用户停止滚动时触发。我已经看到有iOS特定的触摸事件,但是有什么办法可以使用相互共同的代码在iOS和Android上捕获滚动开始事件吗?

To enhance the experience for the user I want to hide() the header when the user starts to scroll and then have it slide in when they stop. The problem is that the scroll event only fires when the user stops scrolling. I've read that there are iOS specific touch events but is there any way I can capture a scroll start event on iOS and Android using mutually common code?

谢谢


Thanks

推荐答案

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

I believe jQuery Mobile, can do this. Take a look at the following code:

$(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");

});

这篇关于如何在iPhone / Android上捕获滚动启动事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆