Display clicked image in a dialog
Description
The following code shows how to display clicked image in a dialog.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.8.3.js'></script>
<script type="text/javascript"
src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.css">
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){<!--from w w w. j ava 2 s. c om-->
$(function(){
$('#imageLists > a').on('click',function(){
var _img = $(this).find('img').attr('src');
$('#image_container').html('<img src="'+_img+'"/>');
});
});
});//]]>
</script>
</head>
<body>
<div data-role="page" id="p1">
<div data-role="header">
<h1>Header Page</h1>
</div>
<div data-role="content" id="imageLists">
<a href="#view_image" data-role="button"><img
src="http://placehold.it/200x200" /></a>
</div>
<div data-role="footer">
<h4>Footer</h4>
</div>
</div>
<div data-role="dialog" id="view_image">
<div data-role="header" data-rel="back">
<h1>Image Container Popup</h1>
</div>
<div data-role="content">
<p id="image_container"></p>
</div>
</div>
</body>
</html>