Jquery mobile 加载页面及其对话框
我正在构建一个多页面的移动web应用程序,其中每个页面都可以有特定的对话框。有没有办法将对话框和页面一起加载Jquery mobile 加载页面及其对话框,jquery-mobile,Jquery Mobile,我正在构建一个多页面的移动web应用程序,其中每个页面都可以有特定的对话框。有没有办法将对话框和页面一起加载 a.html <!DOCTYPE html> <html> <head> <title>B4DATING</title> <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1"> <l
a.html
<!DOCTYPE html>
<html>
<head>
<title>B4DATING</title>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<div data-role="page" data-theme="b">
<div data-role="header" data-position="fixed">
<h1>Page A</h1>
</div>
<div data-role="content">
<a href="b.html" data-role="button">Push me</a>
</div>
</div>
</body>
</html>
<div data-role="page" data-theme="b">
<div data-role="header" data-position="fixed">
<h1>Page B</h1>
<a href="#menu" data-icon="plus" data-iconpos="notext" data-theme="b" class="ui-btn-right" data-rel="dialog">more</a>
</div>
<div data-role="content">
Welcome to Page B!
</div>
</div>
<div data-role="dialog" id="menu" class="dialog-actionsheet">
<div data-role="header" data-theme="d">
<h1>Menu B</h1>
</div>
<div data-role="content" data-theme="c">
<ul data-role="listview" data-inset="false" data-theme="d" data-divider-theme="d" data-icon="false" class="jqm-list">
<li><a href="#">X</a></li>
<li><a href="#">Y</a></li>
<li><a href="#">Z</a></li>
</ul>
</div>
</div>
我需要的是使对话框正常工作(无需进一步的AJAX请求)。jQuery Mobile只需处理整个HTML并将其导入DOM。是否可以使用弹出窗口小部件而不是对话框(弹出窗口包含在页面中)?当您通过Ajax从a.HTML加载b.HTML时,b.HTML中的对话框将被忽略。或者,您可以更改锚点
。或者您可以加载它$.mobile.changePage(“dialogB.html”,{changeHash:false})代码>。我会选择弹出窗口,这是唯一合理的解决方案。谢谢@ezanker。