当我使用jQuery 1.5.2时,为什么这个小提琴才起作用?
当我将其设置为jQuery 1.7.2时,不会显示任何内容
在这里取消选择jQuery Mobile 1.0.1是显示:
应该显示这个:
小提琴代码:
<div data-role="page" id="firstpage">
<div data-role="header">
<h1>First Page</h1>
</div>
<div data-role="content" id="links">
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
<div data-role="page" id="secondpage">
<div data-role="header">
<a href='#' class='ui-btn-left' data-icon='arrow-l' onclick="history.back(); $('#pagecontent').empty(); return false">Back</a><h1>Bar</h1>
</div>
<div id="pagecontent" data-role="content">
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
$(document).ready(function() {
for (var i = 0; i < 4; i++) {
$('#links').append(buildButton());
}
function buildButton() {
var button= '<a data-role="button" href="#secondpage" data-theme="c" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-up-c"><span class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">Link Button</span></span></a>';
return $(button).click(function () {
$("#secondpage").data("val", "test value")
});
}
$('#secondpage').live('pageshow', function() {
var val1= $(this).data('val');
$("#pagecontent").html(val1);
console.log('val is '+ val1);
});
});
答案 0 :(得分:1)
问题在于您选择1.7.2
您还勾选了Mobile 1.0.1
修改强>: 你在这里使用的是错误的版本
将它们更新为最新版本以使用1.7.2
CSS
:http://code.jquery.com/mobile/1.1.0jquery.mobile-1.1.0.css
和
JS
:http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js
与1.7.2
合作:http://jsfiddle.net/azZVk/25/
此外,请勿使用live
我们on
。