我刚学习Jquery Mobile的多个html架构,用于开发phonegap应用程序,目前我正面临一个奇怪的问题,我在Jquery Mobile单页架构中从未遇到过。
App Logic我需要实现: 我有两个html文件(index.html,second.html)我可以从index.html导航到second.html没有问题,现在从second.html我必须导航回index.html但在导航到之前页面应用程序必须根据导航必须获得用户确认(我正在使用cordova对话框插件)。
这是我的代码
的index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
<script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.5.min.css" />
<script type="text/javascript" src="js/backcheck.js"></script>
<title>Hello World</title>
</head>
<body>
<section data-role="page" id="home">
<header data-role="header" data-position="fixed">
<h1>Sample</h1>
<a href="second.html" data-role="button" data-iconpos="notext" data-icon="forward" data-url="second.html">Forward</a>
</header>
<article data-role="content">
<h6>This is Home Page</h6>
<a href="#spasample" data-role="button">Single Page Architecture Page</a>
</article>
</section>
<section data-role="page" id="spasample">
<h1>Sample Page 2</h1>
<a href="#" data-role="button" data-iconpos="notext" data-icon="back" class="backer" >back</a>
</header>
<article data-role="content">
<h6>This is Second Page</h6>
</article>
</section>
<script type="text/javascript" src="cordova.js"></script>
</body>
</html>
second.html
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
<title>Hello World</title>
</head>
<body>
<section data-role="page" id="secondpage">
<header data-role="header" data-position="fixed">
<h1>Sample Page 2</h1>
<a href="#" data-role="button" data-iconpos="notext" data-icon="back" class="backer" >back</a>
</header>
<article data-role="content">
<h6>This is Second Page</h6>
</article>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/backcheck.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.mobile-1.4.5.min.css" />
<script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script>
</section>
</body>
面临的问题: 每当我点击second.html页面中的后退按钮时,它会提示一个确认框,如果我点击任何按钮,它的回叫功能不会立即被调用,而只有当我再次点击后退按钮时它才会被调用。这是什么原因在这背后?
请审核我的代码并帮我修复它!