Jquery mobile js中的JQMobile加载页面
我有一个简单的index.html,有两个页面Jquery mobile js中的JQMobile加载页面,jquery-mobile,Jquery Mobile,我有一个简单的index.html,有两个页面 第1页有一个按钮。。当用户点击它时,我调用js函数 函数openPage2(){ } 此函数应加载第2页。怎么做 我试过了 $.mobile.changePage(“page2.html”); 但它不起作用……我做错了什么?工作示例: HTML: <!DOCTYPE html> <html> <head> <title>jQM Complex Demo</title>
第1页有一个按钮。。当用户点击它时,我调用js函数
函数openPage2(){
}
此函数应加载第2页。怎么做
我试过了
$.mobile.changePage(“page2.html”);
但它不起作用……我做错了什么?工作示例:
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.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="page1">
<div data-theme="a" data-role="header">
<h3>
First Page
</h3>
</div>
<div data-role="content">
<a href="" data-role="button" id="next-page">Next</a>
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
</div>
</div>
<div data-role="page" id="page2">
<div data-theme="a" data-role="header">
<h3>
Second Page
</h3>
<a href="#index" class="ui-btn-left">Back</a>
</div>
<div data-role="content">
</div>
<div data-theme="a" data-role="footer" data-position="fixed">
</div>
</div>
</body>
</html>
$.mobile.changePage(#page2”)代码>
$(document).on('pagebeforeshow', '#page1', function(){
$(document).on('click', '#next-page', function(){
$.mobile.changePage("#page2");
});
});