Skip to content

Instantly share code, notes, and snippets.

@sukima
Created November 8, 2012 13:32
Show Gist options
  • Save sukima/4038818 to your computer and use it in GitHub Desktop.
Save sukima/4038818 to your computer and use it in GitHub Desktop.
// * document is the JavaScript document object
// * bind adds an event listener to the document object
// * pageinit is the event that document object should listen for
// * the anonymous function is the callback that getsw executed when the
// document recieves the pageinit event.
$(document).bind("pageinit", function(){
// Now the pageinit event was triggered
// again lets attach an event listener to the document element #listitem2
// This time the event to listen for is the swipeleft event
// The convinience function swipeleft is the same a s bind("swipeleft",...)
$("#listitem2").swipeleft(function() {
// when the user swipes left it triggers this function and executes the
// process of changing the page with the changePage function.
$.mobile.changePage("home.html");
});
});
@emilesilvis
Copy link

Thanks sukima!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment