jQuery Mobile中jQuery.mobile.changePage方法使用詳解

jQuery Mobile進行頁面跳轉並且傳值給服務器,將服務器返回的內容放到跳轉頁面的div中

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src="https://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script>
$(document).on("pagebeforecreate",function(){
  console.log("觸發 pagebeforecreate 事件 - 在頁面在初始化時,增強開始之前,彈出一些文本信息。")
});
function pagetow(){
	function pagetow(){
	var url = "/m/signReport-loadImg";
	var parm = {'rc':918, 'lat':126, 'lng':36};

	$.mobile.changePage( url , {
	  type: "post",
	  data: parm,
	  changeHash: true
	});
}
	
}

</script>
</head>
<body>
<div data-role="page" id="pageone">
  <div data-role="header">
    <h1>歡迎來到我的主頁</h1>
  </div>

  <div data-role="main" class="ui-content">
    <p>點擊鏈接查看淡入效果 (頁面從右至左淡入)。</p>
    <a href="javascript:void(0);" data-transition="slide" onclick="pagetow();">淡入第二個頁面</a>
  </div>

  <div data-role="footer">
    <h1>底部文本</h1>
  </div>
</div> 

<div data-role="page" id="pagetwo">
  <div data-role="header">
    <h1>歡迎來到我的主頁</h1>
  </div>

  <div data-role="main" class="ui-content">
    <p>點擊鏈接查看相反方向的淡入效果 (頁面從左至右淡入)。</p>
    <a href="#pageone" data-transition="slide" data-direction="reverse">淡入第一個頁面(reversed)</a>
  </div>

  <div data-role="footer">
    <h1>底部文本</h1>
  </div>
</div> 

</body>
</html>

 

發佈了57 篇原創文章 · 獲贊 4 · 訪問量 7483
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章