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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章