jquerymobile页面跳转切换的几种方式

mthoutai      2022-02-11     297

关键词:

jQuery Mobile在移动开发中越来越受到欢迎。

而他的各个版本号也在持续不断的更新中。相同的我也非常喜欢它,它加快了我们开发HTML5的速度。


同一时候又具备jQuery一样的操作方法。

学起来也是相当的easy。所以这一片文章就是介绍jQuery Mobile的页面跳转的。
少说废话,看源代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>jQuery Mobile页面跳转切换的几种方式</title>
	
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
	<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
	<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
	<!--<link rel="stylesheet" type="text/css" href="../jQuery/jquery.mobile-1.3.2.min.css">
	<script type="text/javascript" src="../jQuery/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="../jQuery/jquery.mobile-1.3.2.min.js"></script>
  --></head>
  
  <body>
    <div data-role="page" id="welPage" data-theme="a">
		<div data-role="header" data-position="fixed" data-theme="a">
			<h1>
				涛哥伪专家管理系统
			</h1>
			<a href="javascript:location.reload();" data-role="button" class="ui-btn-right" data-icon="refresh">刷新</a>
		</div>

		<div data-role="content">
			<p>我是第一个页面</p>
			<p>
				如有不懂,请加qq群:135430763,共同学习!

</p> <p> 如有不懂。请加qq群:135430763,共同学习!

</p> <p> 如有不懂,请加qq群:135430763。共同学习! </p> <p> 如有不懂。请加qq群:135430763,共同学习!

</p> <a href="#nextPage" >跳转到下一个页面</a> </div> <div id="footer" data-role="footer" data-theme="a" data-position="fixed"> <h1> 涛哥伪专家管理系统 </h1> </div> </div> <div data-role="page" id="nextPage" data-theme="a"> <div data-role="header" data-position="fixed" data-theme="a"> <h1> 涛哥伪专家管理系统 </h1> <a href="javascript:location.reload();" data-role="button" class="ui-btn-right" data-icon="refresh">刷新</a> </div> <div data-role="content"> <p>我是第二个页面</p> <p> 如有不懂,请加qq群:135430763,共同学习!

</p> <p> 如有不懂。请加qq群:135430763,共同学习! </p> <p> 如有不懂,请加qq群:135430763,共同学习! </p> <p> 如有不懂。请加qq群:135430763。共同学习! </p> <a href="#goPage" >跳转到下一个页面</a> </div> <div id="footer" data-role="footer" data-theme="a" data-position="fixed"> <h1> 涛哥伪专家管理系统 </h1> </div> </div> <div data-role="page" id="goPage" data-theme="a"> <div data-role="header" data-position="fixed" data-theme="a"> <h1> 涛哥伪专家管理系统 </h1> <a href="javascript:location.reload();" data-role="button" class="ui-btn-right" data-icon="refresh">刷新</a> </div> <div data-role="content"> <p>我是第三个页面</p> <p> 如有不懂,请加qq群:135430763。共同学习!

</p> <p>有几种方法来切换页面</p> <p>1. $.mobile.changePage ('../path/to/page.html');</p> <p>2. $.mobile.changePage ('other/page.html', 'fade', false, false);</p> <p>能够设定页面切换效果,以及定义參数来控制页面是否记录历史等</p> <p>3.var pageData = { url: formresults.php, type: 'get', data:</p> <p>$('form#myform').serialize () };</p> <p>$.mobile.changePage (pageData);</p> <p>将页面url,类型,数据定义为变量来传递。

</p> <p>4.var previousPage = $.mobile.activePage.data ('ui.prevPage');</p> <p>$.mobile.changePage ([previousPage, anotherPreviousPage], 'pop');</p> <p>使用changepage来载入第三个页面</p> <p>5.$.mobile.pageLoading (); /显示载入信息</p> <p>$.mobile.pageLoading (true); //隐藏</p> <p>pageLoading(boolean done)</p> <p>函数显示或隐藏页面载入的提示信息。

能够在$.mobile.loadingMessage变量中设置。

</p> <p>6 .$.mobile.silentScroll (100);</p> <p>silentScroll (number yPos): 在Y轴上(默觉得0)滚动页面而不须要触发scroll事件</p> <a href="#welPage" >跳转到第一个页面</a> </div> <div id="footer" data-role="footer" data-theme="a" data-position="fixed"> <h1> 涛哥伪专家管理系统 </h1> </div> </div> <script type="text/javascript"> //home菜单的onclick事件的处理方法 function fun1(){ //激活nav1 $('#nav1').addClass('ui-btn-active'); //显示我home菜单的内容 $('#show1').css('display',''); //grid,search,info都隐藏 $('#show2').css('display','none'); $('#show3').css('display','none'); $('#show4').css('display','none'); //nav2,nav3,nav4 取消激活 $('#nav2').removeClass('ui-btn-active'); $('#nav3').removeClass('ui-btn-active'); $('#nav4').removeClass('ui-btn-active'); } //grid菜单的onclick事件的处理方法 function fun2(){ //激活nav2 $('#nav2').addClass('ui-btn-active'); //显示我grid菜单的内容,home,search,info都隐藏 $('#show1').css('display','none'); $('#show2').css('display',''); $('#show3').css('display','none'); $('#show4').css('display','none'); //nav1。nav3。nav4 取消激活 $('#nav1').removeClass('ui-btn-active'); $('#nav3').removeClass('ui-btn-active'); $('#nav4').removeClass('ui-btn-active'); } //search菜单的onclick事件的处理方法 function fun3(){ //激活nav3 $('#nav3').addClass('ui-btn-active'); $('#show1').css('display','none'); $('#show2').css('display','none'); //显示我search菜单的内容,home,grid,info都隐藏 $('#show3').css('display',''); $('#show4').css('display','none'); //nav1。nav2,nav4 取消激活 $('#nav2').removeClass('ui-btn-active'); $('#nav1').removeClass('ui-btn-active'); $('#nav4').removeClass('ui-btn-active'); } //info菜单的onclick事件的处理方法 function fun4(){ $('#nav4').addClass('ui-btn-active'); $('#show1').css('display','none'); $('#show2').css('display','none'); $('#show3').css('display','none'); //显示我info菜单的内容,home,grid,search都隐藏 $('#show4').css('display',''); //nav1,nav2。nav3 取消激活 $('#nav2').removeClass('ui-btn-active'); $('#nav3').removeClass('ui-btn-active'); $('#nav1').removeClass('ui-btn-active'); } </script> </body> </html>

其它方法:
1. $.mobile.changePage ('../path/to/page.html');
2. $.mobile.changePage ('other/page.html', 'fade', false, false);
能够设定页面切换效果。以及定义參数来控制页面是否记录历史等
3.var pageData = { url: formresults.php, type: 'get', data:
$('form#myform').serialize () };
$.mobile.changePage (pageData);
将页面url。类型。数据定义为变量来传递。4.
var previousPage = $.mobile.activePage.data ('ui.prevPage');
$.mobile.changePage ([previousPage, anotherPreviousPage], 'pop');
使用changepage来载入第三个页面
5.$.mobile.pageLoading ();  /显示载入信息
$.mobile.pageLoading (true); //隐藏
pageLoading(boolean done)
函数显示或隐藏页面载入的提示信息。能够在$.mobile.loadingMessage变量中设置。

6 .$.mobile.silentScroll (100); silentScroll (number yPos): 在Y轴上(默觉得0)滚动页面而不须要触发scroll事件


OK,到此结束了。欢迎大家关注我的个人博客。

如有不懂,请大家增加qq群:135430763共同学习!




javascript实现页面跳转的几种方式

Javascript实现页面跳转的几种方式概述  相信很多Web开发者都知道,在开发Web程序的时候,对于页面之间的跳转,有很多种,但是有效的跳转则事半功倍,下面就是我在平时的开发过程中所用到的一些JavaScript跳转方式,拿... 查看详情

js页面跳转常用的几种方式(转)

js页面跳转常用的几种方式转载  2010-11-25 作者:   我要评论js实现页面跳转的几种方式,需要的朋友可以参考下。第一种: 复制代码代码如下:<scriptlanguage="javascript"type="text/javascript"> window.location... 查看详情

实现前端页面跳转的几种方式

实现前端页面跳转的几种方式推荐使用<scriptlanguage=‘javascript‘>document.location=‘http://mail.qq.com/domain/longtimenosee.cc‘</script>相关阅读http://www.jb51.net/article/25403.htmhttp://my.oschina.net/ososchi 查看详情

javascript实现页面跳转的几种方式

...sp;相信很多Web开发者都知道,在开发Web程序的时候,对于页面之间的跳转,有很多种,但是有效的跳转则事半功倍,下面就是我在平时的开发过程中所用到的一些JavaScript跳转方式,拿出和大家共享一下。 第一种:直接跳转... 查看详情

javascript实现页面跳转的几种方式

...sp;相信很多Web开发者都知道,在开发Web程序的时候,对于页面之间的跳转,有很多种,但是有效的跳转则事半功倍,下面就是我在平时的开发过程中所用到的一些JavaScript跳转方式,拿出和大家共享一下。 第一种:直接跳转... 查看详情

js实现页面跳转的几种方式

第一种:<scriptlanguage="javascript" type="text/javascript">  window.location.href="login.php?backurl="+window.location.href;</script> 第二种:<scriptlanguage="javascript">  alert( 查看详情

js实现页面跳转的几种方式

第一种:    <scriptlanguage="javascript"type="text/javascript">               window.location.href="xx. 查看详情

页面跳转的几种方式

第一种:   <scriptlanguage="javascript">          window.location.href="index.php";        &n 查看详情

js页面跳转常用的几种方式

第一种: <scriptlanguage="javascript"type="text/javascript">window.location.href="jb51.jsp?backurl="+window.location.href;</script>第二种: <scriptlanguage="javascript">alert("返回") 查看详情

js页面跳转常用的几种方式

第一种:代码如下:<scriptlanguage="javascript"type="text/javascript">window.location.href="jb51.jsp?backurl="+window.location.href;</script>第二种:代码如下:<scriptlanguage="javascript">alert("返回");w 查看详情

js页面跳转常用的几种方式

第一种: 代码如下:<scriptlanguage="javascript"type="text/javascript"> window.location.href="jb51.jsp?backurl="+window.location.href; </script> 第二种: 代码如下:<scriptlanguage 查看详情

js跳转页面的几种方法

JS的几种跳转方式:1.window.open(”url“)2.用自定义函数<script>functionopenWin(tag,obj){obj.target="_blank";obj.href="Web/Substation/Substation.aspx?stationno="+tag;obj.click();}</script><ahref="javascr 查看详情

实现跳转的几种法式

...意义。跳转就是当我们点击按钮或者实现某个活动从一个页面到另一个页面,那么我就来介绍几种跳转的法式。 第一种跳转方式-----Storyboard中segues(拉线):              &nb... 查看详情

uniapp页面跳转的几种方式(代码片段)

uniapp页面跳转的几种方式一、uni.navigateTo定义:保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack可以返回到原页面。使用://1.不传参uni.navigateTo(url:'./home/index');//2.传参字符串uni.navigateTo(url:`./ho... 查看详情

总结一下,微信小程序的几种跳转方式

参考技术A跳转至另外一个页面,不会把之前的页面销毁。但是带有返回箭头,点击可以返回到上一页,但是回到上一页的时候不会重新刷新这一页的数据。跳转至tabbar页,当用户点击时,会跳转到相应的tabbar页面,只能跳转到ta... 查看详情

html+jsvue页面跳转的几种方式总结(代码片段)

...;JS实现跳转:特别提醒:有些跳转方式是只能跳转一级页面,有些可以跳转多级页面,在使用时要注意选择跳转方式!1、javascript中实现跳转://直接跳转window.location.href='index.html';//定时跳转setTimeout("... 查看详情

js实现页面跳转的几种方法(代码片段)

要实现从一个页面A跳到另一个页面B,js实现就在A的js代码加跳转代码JS跳转大概有以下几种方式:第一种:(跳转到b.html)<script language="javascript" type="text/javascript">window.location.href="b.html";</script>第二种:(返回上一... 查看详情

vue路由跳转页面的几种方式及其区别

参考技术A场景:A页面跳转到B页面并携带参数1.1不带参数:1.2带参数:2.1不带参数:2.2query传参2.3params传参2.4直接通过path传参2.5传递对象(obj不能过长否则会报错)2.6params和query的区别用法同上:this.$router.push()向前或者向后跳转n个... 查看详情