我對你的想法很少。
首先我給你做的,你怎麼能一個ListView元素後點擊創建一個動態頁面的例子: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的頁面事件來看看這個ARTICLE,或者發現它HERE。
任何人,想法? :) – Nactus