$.mobile.changePage shows 'to' page, but then sends back to 'from' page
Hello everyone,
I'v been playing around with jquery mobile and I have to say that i like it. I have came across this issue - I have two pages and I have connected to the 'swipe' event and I am trying to go from one page to other. It works fine, but after few swipes it starts to behave weird. I am on page1 and I swipe to page2 which shows up and then it seems like changePage is triggered immediately again and takes me back to page1. Could anyone give me advice what am I doing wrong?
Here is my code of page1:
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Page1</title>
- <link rel="stylesheet" href="css/jquery.mobile-1.2.0.css" />
- <script type="text/javascript" src="js/jquery-1.8.2.js"></script>
- <script type="text/javascript" src="js/jquery.mobile-1.2.0.js"></script>
- </head>
- <body>
- <!--HEADER-->
- <div id="page1" data-role="page">
- <script type="text/javascript">
-
- $("#page1").live('swipeleft',function(){
- $.mobile.changePage("/t/page2.html")
- })
-
- </script>
- <div id="header" data-role="header" data-position="fixed" data-theme="b">
- <h1>Page 1</h1>
- <p class="ui-btn-right time" style="margin-top:.6em;"></p>
- <div data-role="navbar">
- <ul>
- <li><a href="/t/page1.html" class="ui-btn-active ui-state-persist" data-prefetch>Page 1</a></li>
- <li><a href="/t/page2.html" data-prefetch>Page 2</a></li>
- </ul>
- </div>
- </div>
- <!--CONTENT-->
- <div id="content" data-role="content" style="height: 100%;">
- This is page 1.
- </div>
- <!--FOOTER-->
- <div id="footer" data-role="footer" data-position="fixed" data-theme="b">
- <h3>2012 © Me</h3>
- </div>
- </div>
- </body>
- </html>
And here is code of my page2:
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Page2</title>
- <link rel="stylesheet" href="css/jquery.mobile-1.2.0.css" />
- <script type="text/javascript" src="js/jquery-1.8.2.js"></script>
- <script type="text/javascript" src="js/jquery.mobile-1.2.0.js"></script>
- </head>
- <body>
- <div id="page2" data-role="page">
- <script type="text/javascript">
-
- $("#page2").live('swiperight',function(){
- $.mobile.changePage("/t/page1.html")
- })
-
- </script>
- <!--HEADER-->
- <div id="header" data-role="header" data-position="fixed" data-theme="b">
- <h1>Page 2</h1>
- <p class="ui-btn-right time" style="margin-top:.6em;"></p>
- <div data-role="navbar">
- <ul>
- <li><a href="/t/page1.html" data-prefetch>Page 1</a></li>
- <li><a href="/t/page2.html" class="ui-btn-active ui-state-persist" data-prefetch>Page 2</a></li>
- </ul>
- </div>
- </div>
- <!--CONTENT-->
- <div id="content" data-role="content" style="height: 100%;">
- This is page 2
- </div>
- <!--FOOTER-->
- <div id="footer" data-role="footer" data-position="fixed" data-theme="b">
- <h3>2012 © Me</h3>
- </div>
- </div>
- </body>
- </html>
I'v been testing this with latest Google Chrome on Windows XP.