Reputation: 356
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.
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
Upvotes: 2
Views: 18137
Reputation:
This scrollstart event is faulty in the default android browser for android 2.3.4 The scrollstart event doesn't fire 100% of the time when the user starts a scroll. I am trying to track down problem. I am looking for any event that fires just before the scrollstart event. It could also be a conflicting event somewhere in my code. I need to rule that out first.
Upvotes: 2
Reputation: 5580
You can start with jQuery Touchwipe : it's a plugin which add new events, wipeleft and wiperight.
It can be easily modified to change horizontal wipes to vertical ones (changing x's to y's) http://plugins.jquery.com/project/Touchwipe-iPhone-iPad-wipe-gesture
It works on Android, IOS and BBOS.
Upvotes: 2
Reputation: 7519
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");
});
Upvotes: 5