我对你的想法很少。
首先,我为您提供了一个示例,说明如何在单击列表视图元素后创建动态页面:http: //jsfiddle.net/Gajotres/nsfkx/
HTML:
<!DOCTYPE html>
<html>
<head>
<title>jQM Complex Demo</title>
<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.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page" id="index">
<div data-theme="a" data-role="header">
<h3>
First Page
</h3>
</div>
<div data-role="content">
<ul data-role="listview" data-theme="a">
<li data-id="1"><a>Dynamic page 1</a></li>
<li data-id="1"><a>Dynamic page 2</a></li>
<li data-id="1"><a>Dynamic page 3</a></li>
</ul>
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
</div>
</div>
</body>
</html>
JS:
$(document).on('pagecreate', '#index', function(){
$(document).on('click', '[data-role="listview"] li', function(event) {
if(event.handled !== true) // This will prevent event triggering more then once
{
console.log('click');
event.handled = true; // click event is handled, dont bind it again
var nextPageId = parseInt($('body [data-role="page"]').length)+1;
$('[data-role="page"]').last().after('<div data-role="page" id="article'+nextPageId+'"><div data-role="header" data-theme="b" data-position="fixed" data-id="footer"><h1>Articles</h1><a href="#" data-rel="back" data-role="button" data-theme="b" class="ui-btn-left">Back</a></div><div data-role="content"><p>Article '+nextPageId+'</p></div><div data-role="footer" data-theme="b" data-position="fixed" data-id="footer"><h1>Footer</h1></div></article>');
//console.log($('body').html());
//$('#article'+nextPageId).trigger('pagecreate');
$.mobile.changePage('#article'+nextPageId, {transition: "slide", reverse: false}, true, true);
}
});
});
第二件事,因为您要创建动态内容,所以您需要放弃准备好文档并切换到正确的 jquery Mobile 页面事件。
如果你想了解更多关于 jQuery Mobile 页面事件的信息,请查看这篇文章,或者在这里找到它。