mhartington
mhartington

Reputation: 7025

jquery mobile swipe functions

I have a swipe function set up on a web app for ipad so that once a user swipes right wit their finger, it takes them to the last page they went to. That javascript looks like this

    <script>
$(document).bind('swiperight', function () {
        history.back();
    });</script>

Now with that in mind, if I wanted to make the function more exact, so that it would change to a particular page, would I incorporate the JQM change page function?

    <script>
$(document).bind('swiperight', function () {
       $.mobile.changePage( "#home", { transition: "slide"} );
    });</script>

And where would I put the attribute for data-direction="reverse"?

Upvotes: 0

Views: 303

Answers (1)

Gajotres
Gajotres

Reputation: 57309

It should look like this:

$(document).bind('swiperight', function () {
    $.mobile.changePage("#home", {
        transition: "slide",
        reverse: true
    });
});

Upvotes: 1

Related Questions