2014-09-06 82 views
1

我有两个页面:index.html和right.html。基于滑动导航到页面

需要什么样的代码,通过水平滑动屏幕从index.html转到right.html?

我使用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? 
    } 
}); 
+0

可能重复[如何在几个jQuery移动页面之间滑动?](http://stackoverflow.com/questions/7533772/how-to-swipe-between-several-jquery-mobile-pages) – Emre 2014-09-06 20:07:22

回答

0

您需要预取的页面,然后更改页面,你使用jQuery,所以您的代码将是这样的:的

$(document).on("swipeleft", "#indexId", function() { 
     $.mobile.loadPage("right.html"); 
     $.mobile.changePage("right.html", { transition: "slide" }); 
    });