jQuery Mobile开发方法和实用工具

移动开发
本文将讲述jQuery Mobile在$.mobile对象里公开了一系列的开发方法和实用工具,这些开发方法和实用工具可以来辅助您完成自己的应用程序.

$.mobile.changePage (method)

从一个页面到另一个页面可以编程来改变.该方法用于页面间跳转,以点击一个链接或者提交表单的形式出现, (当那些特性被启用时).

Arguments

to

◆String, url: ("about/us.html")

◆jQuery 对象 ($("#about"))

◆一个指定了两个页面引用的数组[from,to] ,用以在已知的page进行跳转. From 是当前所能看到的页面( 或者是 $.mobile.activePage ).

◆发送表单数据的对象. ({to: url, data: serialized form data, type: "get" or "post"}

transition (string, 过渡效果: "pop", "slide"," "none")

reverse (boolean, default: false). 设置为true时将导致一个反方向的跳转.

changeHash (boolean, default: true). 当页面change完成时更新页面的URL hash.

示例:

//以slideup效果 跳转到 "about us" 页面 
 
$.mobile.changePage("about/us.html", "slideup"); 
 
//跳转到 "search results" 页面,提交id为 "search"的表单数据 
 
$.mobile.changePage({ 
 
url: "searchresults.php", 
 
type: "get", 
 
data: $("form#search").serialize() 
 
}); 
 
//以pop效果 跳转到 "confirm" 页面 并且在url hash里不记录其历史 
 
$.mobile.changePage("../alerts/confirm.html", "pop", false, false); 
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.

$.mobile.pageLoading (method)

显示或隐藏 页面加载消息,该消息由$.mobile.loadingMessage进行配置.

Arguments:

Done (boolean,默认为 false, 这意味着加载已经开始). 设置为True会隐藏 页面加载消息.

示例:

//提示页面加载 
 
$.mobile.pageLoading(); 
 
//隐藏页面加载 
 
$.mobile.pageLoading( true ); 
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.

$.mobile.path (methods, properties)

Utilities for getting, setting, and manipulating url paths. TODO: document as public API is finalized.

$.mobile.base (methods, properties)

Utilities for working with generated base element. TODO: document as public API is finalized.

$.mobile.silentScroll (method)

在不触发scroll事件处理程序的情况下在Y轴上进行滚动.

Arguments:

yPos (number, 默认为 0). 传递任何数字以在Y坐标上进行滚动.

示例:

// Y上滚动 100px 
 
$.mobile.silentScroll(100); 
  • 1.
  • 2.
  • 3.

$.mobile.addResolutionBreakpoints (method)

为min/max width class 添加width折断点 被添加到HTML元素上. (译注:折断点指的是当屏幕或浏览器宽度在到达某个范围时,容器元素将会发生折断现象--比如当宽度为480时2个radiobutton会排成一排,而宽度改变为320时,2个radiobutton可能会自动折断成两排)

Arguments:

values (number 或者 array). 传递任何数字或者数字数组.

示例:

//添加一个 400px 的分辨率断点 
 
$.mobile.addResolutionBreakpoints(400); 
 
//添加二个分辨率断点 
 
$.mobile.addResolutionBreakpoints([600,800]); 
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.

 

责任编辑:佚名 来源: filod
相关推荐

2009-07-10 17:54:29

SwingUtilit

2022-02-25 09:03:49

工具Swift项目

2011-01-14 13:40:24

UbuntuLinux Tips

2023-08-02 10:41:26

2025-03-04 10:49:51

2013-02-27 10:42:07

前端工具Web

2017-04-28 14:47:23

人工智能

2013-11-29 10:35:34

命令行工具ncdu

2011-04-13 09:40:27

2019-07-12 08:00:00

Mac应用程序实用工具

2011-07-20 10:08:05

NetXray

2019-03-19 09:00:00

LinuxBackBox渗透测试

2022-04-26 09:01:39

实用工具类型TypeScript

2019-06-17 09:55:05

GPartedLinux根分区

2023-09-03 17:03:54

工具RegexGPTBloop

2020-10-26 10:00:28

Linux工具命令

2019-12-27 09:00:28

Azure工具Azure平台

2011-01-24 15:52:07

2009-09-10 09:31:15

Linux无线网络Linux实用工具

2015-10-10 15:09:46

推荐工具Linux
点赞
收藏

51CTO技术栈公众号