Closed mlitwin closed 13 years ago
Sample code I've started playing with: when JQM loads a page, we check for a "prev" link, and attache the correct event handler. In hesperian_mobile_init.js, something like:
$("div:jqmData(role='page')").live('pagebeforecreate',function(event){
$(this).bind('swipeleft',function(event){
var button = $("div:jqmData(role='footer') > a:jqmData(icon='arrow-l')",this).first();
if( button && !button.attr('disabled')) {
var href = button.attr('href');
$.mobile.changePage(href);
}
});
});
Lots of cleanup / fixing here - but does illustrate how I'm currently thinking of handling this: programmatic detection of the prev / next buttons by some criterion, and binding an appropriate generic swipe handler to that page to basically forward the swipes to the action of the buttons.
Saq implemented this - closing
Jquery mobile supports the swipe gesture: http://jquerymobile.com/demos/1.0a4.1/docs/api/events.html
It would be elegant if we can use jquery magic to map the swipe automatically to the current next / prev buttons on the active page.