1

I have two pages: index.html and right.html.

What kind of a code is required, to go to right.html from index.html by swiping the screen horizontally?

I am using jQuery Mobile

$(function()
{
    $(document).on( "swipeleft", swipeleftHandler );

    function swipeleftHandler( event )
    {
        // What is the code that should come here?
        // And how can I design it so index.html slides to left 
        // and right.html comes to the middle?
    }
});
jww
  • 97,681
  • 90
  • 411
  • 885
Robert
  • 103
  • 1
  • 1
  • 8
  • possible duplicate of [How to swipe between several jquery mobile pages?](http://stackoverflow.com/questions/7533772/how-to-swipe-between-several-jquery-mobile-pages) – Emre Sep 06 '14 at 20:07

1 Answers1

0

You need to prefetch the page and then change the page as you using jquery, so your code will be something like this:

    $(document).on("swipeleft", "#indexId", function() {
        $.mobile.loadPage("right.html");
        $.mobile.changePage("right.html", { transition: "slide" });
    });
V31
  • 7,626
  • 3
  • 26
  • 44