工作示例:http: //jsfiddle.net/Gajotres/MU26F/
这是您的请求的变体。在此示例中,图像在一个页面上排序,单击它将显示在另一个页面中。选择的页面转换是弹出的。如果在查看器关闭后动态创建和删除第二个页面,则此示例甚至可以更小。
HTML:
<!DOCTYPE html>
<html>
<head>
<title>jQM Complex Demo</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<!--<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>-->
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
</head>
<body>
<div data-role="page" id="index">
<div data-theme="b" data-role="header">
<h1>Index page</h1>
</div>
<div data-role="content" id="galery-content">
<a id="parispop" href="#"><img class="popphoto" src="http://www.glsvlsi.org/paris_pic.jpg" alt="Paris, France" style="width:30%"/></a>
<a id="sydnypop" href="#"><img class="popphoto" src="http://sydneylivingtoday.com/public/admin/Sydney-australia.jpg" alt="Sydney, Australia" style="width:30%"/></a>
<a id="newyorkpop" href="#popupNYC"><img class="popphoto" src="http://www.burgessyachts.com/media/adminforms/locations/n/e/new_york_1.jpg" alt="New York, USA" style="width:30%"/></a>
</div>
</div>
<div data-role="page" id="galery">
<div data-theme="b" data-role="header">
<a href="#index" class="ui-btn-left">Back</a>
<h1>Viewer</h1>
</div>
<div data-role="content" id="image-content">
<img src="" width="100%" height="auto"/>
</div>
</div>
</body>
</html>
Javascript:
$(document).on('pageinit', '#index', function(){
$(document).on('click', '#galery-content a', function(){
$('#image-content img').attr('src',$(this).find('img').attr('src'));
$.mobile.changePage( "#galery", { transition: "pop", changeHash: false });
});
});
CSS:
#image-content {
position: absolute !important;
top: 40px !important;
left:0 !important;
bottom:0 !important;
right:0 !important;
}