小强的HTML5移动开发之路(44)——JqueryMobile中的按钮
一、链接按钮
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Mobile Web 应用程序</title>
<link href="jquery-mobile/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
</head>
<body>
<div data-role="page" id="page1" data-fullscreen="true">
<div data-role="content">
<a href="#" data-role="button">链接按钮</a>
</div>
</div>
</body>
</html>
二、表单按钮
<div data-role="page" id="page1" data-fullscreen="true">
<div data-role="content">
<a href="#" data-role="button">链接按钮</a>
<form>
<input type="button" value="表单按钮"/>
<button type="submit">提交按钮</button>
<input type="submit" value="提交按钮"/>
<input type="reset" value="重置按钮"/>
</form>
</div>
</div>
三、图形按钮
图像按钮1:
<input type="image" src="jquery-mobile/images/icon.png" data-role="none"/>
图像按钮2:
<a href="#"><img src="jquery-mobile/images/icon.png"></a>
四、带图标的按钮
<input type="button" value="带图标的按钮" data-icon="delete"/>
<input type="button" data-icon="delete" data-iconpos="notext"/>
<input type="button" data-icon="alert" data-iconpos="notext"/>
<input type="button" data-icon="arrow-d" data-iconpos="notext"/>
<input type="button" data-icon="arrow-l" data-iconpos="notext"/>
<input type="button" data-icon="arrow-r" data-iconpos="notext"/>
<input type="button" data-icon="arrow-u" data-iconpos="notext"/>
<input type="button" data-icon="back" data-iconpos="notext"/>
<input type="button" data-icon="check" data-iconpos="notext"/>
<input type="button" data-icon="custom" data-iconpos="notext"/>
<input type="button" data-icon="forward" data-iconpos="notext"/>
<input type="button" data-icon="gear" data-iconpos="notext"/>
<input type="button" data-icon="grid" data-iconpos="notext"/>
<input type="button" data-icon="home" data-iconpos="notext"/>
<input type="button" data-icon="info" data-iconpos="notext"/>
<input type="button" data-icon="minus" data-iconpos="notext"/>
<input type="button" data-icon="plus" data-iconpos="notext"/>
<input type="button" data-icon="refresh" data-iconpos="notext"/>
<input type="button" data-icon="search" data-iconpos="notext"/>
<input type="button" data-icon="star" data-iconpos="notext"/>
五、按钮定位
<a href="#" data-role="button" data-icon="arrow-u" data-iconpos="top">top</a>
<a href="#" data-role="button" data-icon="arrow-l" data-iconpos="left">left</a>
<a href="#" data-role="button" data-icon="arrow-r" data-iconpos="right">right</a>
<a href="#" data-role="button" data-icon="arrow-d" data-iconpos="bottom">bottom</a>
六、自定义图标按钮
<a href="#" data-role="button" data-icon="custom_icon">自定义图标</a>
.ui-icon-custom_icon{
background:url(jquery-mobile/images/icon.png) 50% 50% no-repeat;
background-size:14px 14px;
}
注意:属性命名规则“.ui-icon-<data-icon-value>,如上面的.ui-icon-custom_icon
七、分组按钮
<div data-role="controlgroup" data-type="horizontal" align="center" class="segment-control">
<a href="#" data-role="button" class="ui-control-active">菜单一</a>
<a href="#" data-role="button" class="ui-control-inactive">菜单二</a>
<a href="#" data-role="button" class="ui-control-inactive">菜单三</a>
</div>
八、主题按钮
<a href="#" data-role="button" data-theme="a">A</a>
<a href="#" data-role="button" data-theme="b">B</a>
<a href="#" data-role="button" data-theme="c">C</a>
<a href="#" data-role="button" data-theme="d">D</a>
<a href="#" data-role="button" data-theme="e">E</a>
<a href="#" data-role="button" data-theme="f">F</a>
九、动态按钮
<script type="text/javascript">
$('<a href="#" data-role="button" data-icon="star" id="b1">动态按钮</a>').appendTo("#content").button();
$('<a href="#" data-role="button" data-icon="delete" id="b2">动态按钮</a>').insertAfter("#b1").button();
</script>
还有一种json方式的
$('<a href="#">动态按钮</a>').insertAfter("#a1").button({
'icon':'home',
'inline':true,
'shadow':true,
'theme':'b'
});
上面两种方式都用到了button()插件,button插件具有如下选项:
corners boolean
icon string
iconpos string
iconshadow boolean
initSelector css selector string
inline boolean
shadow boolean
button插件有如下两个方法:
$("#button1").button("enable");
$("#button2").button("disable");
全部代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Mobile Web 应用程序</title>
<link href="jquery-mobile/jquery.mobile-1.0.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-mobile/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile-1.0.min.js" type="text/javascript"></script>
<style type="text/css">
.ui-icon-custom_icon{
background:url(jquery-mobile/images/icon.png) 50% 50% no-repeat;
background-size:14px 14px;
}
</style>
</head>
<body>
<div data-role="page" id="page1" data-fullscreen="true">
<div data-role="content" class="content" id="content">
<a href="#" data-role="button">链接按钮</a>
<form>
<input type="button" value="表单按钮"/>
<button type="submit">提交按钮</button>
<input type="submit" value="提交按钮"/>
<input type="reset" value="重置按钮"/>
图像按钮1:
<input type="image" src="jquery-mobile/images/icon.png" data-role="none"/>
图像按钮2:
<a href="#"><img src="jquery-mobile/images/icon.png"></a> <input type="button" value="带图标的按钮" data-icon="delete"/>
<input type="button" data-icon="delete" data-iconpos="notext"/>
<input type="button" data-icon="alert" data-iconpos="notext"/>
<input type="button" data-icon="arrow-d" data-iconpos="notext"/>
<input type="button" data-icon="arrow-l" data-iconpos="notext"/>
<input type="button" data-icon="arrow-r" data-iconpos="notext"/>
<input type="button" data-icon="arrow-u" data-iconpos="notext"/>
<input type="button" data-icon="back" data-iconpos="notext"/>
<input type="button" data-icon="check" data-iconpos="notext"/>
<input type="button" data-icon="custom" data-iconpos="notext"/>
<input type="button" data-icon="forward" data-iconpos="notext"/>
<input type="button" data-icon="gear" data-iconpos="notext"/>
<input type="button" data-icon="grid" data-iconpos="notext"/>
<input type="button" data-icon="home" data-iconpos="notext"/>
<input type="button" data-icon="info" data-iconpos="notext"/>
<input type="button" data-icon="minus" data-iconpos="notext"/>
<input type="button" data-icon="plus" data-iconpos="notext"/>
<input type="button" data-icon="refresh" data-iconpos="notext"/>
<input type="button" data-icon="search" data-iconpos="notext"/>
<input type="button" data-icon="star" data-iconpos="notext"/> <a href="#" data-role="button" data-icon="arrow-u" data-iconpos="top">top</a>
<a href="#" data-role="button" data-icon="arrow-l" data-iconpos="left">left</a>
<a href="#" data-role="button" data-icon="arrow-r" data-iconpos="right">right</a>
<a href="#" data-role="button" data-icon="arrow-d" data-iconpos="bottom">bottom</a> <a href="#" data-role="button" data-icon="custom_icon">自定义图标</a> <a href="#" data-role="button" data-theme="a">A</a>
<a href="#" data-role="button" data-theme="b">B</a>
<a href="#" data-role="button" data-theme="c">C</a>
<a href="#" data-role="button" data-theme="d">D</a>
<a href="#" data-role="button" data-theme="e" id="a1">E</a>
<a href="#" data-role="button" data-theme="f" id="b1">F</a>
</form>
</div>
</div>
</body>
<script type="text/javascript">
$('<a href="#" data-role="button" data-icon="star" id="b1">动态按钮</a>').appendTo("#content").button();
$('<a href="#" data-role="button" data-icon="delete" id="b2">动态按钮</a>').insertAfter("#b1").button();
$('<a href="#">动态按钮</a>').insertAfter("#a1").button({
'icon':'home',
'inline':true,
'shadow':true,
'theme':'b'
});
</script>
</html>
小强的HTML5移动开发之路(44)——JqueryMobile中的按钮的更多相关文章
- 小强的HTML5移动开发之路(18)——HTML5地理定位
来自:http://blog.csdn.net/dawanganban/article/details/18192091 在前面的<小强的HTML5移动开发之路(2)--HTML5的新特性> ...
- 小强的HTML5移动开发之路(14)——Video标签详解
来自:http://blog.csdn.net/dawanganban/article/details/18180605 在前面的小强的HTML5移动开发之路(5)--制作一个漂亮的视频播放器中制作了 ...
- 小强的HTML5移动开发之路(13)——HTML5中的全局属性
来自:http://blog.csdn.net/dawanganban/article/details/18179483 一.accssskey 快捷键 <!DOCTYPE HTML> ...
- 小强的HTML5移动开发之路(11)——链接,图片,表格,框架
来自:http://blog.csdn.net/dawanganban/article/details/18098193 一.HTML是什么? HTML(hypertext mark-uplangua ...
- 小强的HTML5移动开发之路(42)——HTML4与HTML5文档结构比较
一般来说,人们在书写包括HTML在内的文档时,习惯上按照类似于"章--节--小节"这样的层次结构来进行. 在HTML4中的描述方式: <html> <head&g ...
- 小强的HTML5移动开发之路(37)——jqMobi快速入门
在<小强的HTML5移动开发之路(33)-- jqMobi基础>中我们了解了什么是jqMobi,并从官方下载了jqMobi开发包,下载后解压目录如下: 拷贝上面的/css目录./plugi ...
- 小强的HTML5移动开发之路(12)——从一个多媒体标签说起
来自:http://blog.csdn.net/dawanganban/article/details/18136813 一.视频播放 <html> <head> <ti ...
- 小强的HTML5移动开发之路(3)——HTML5与HTML4比较
来自:http://blog.csdn.net/dawanganban/article/details/17652873 在前面介绍了HTML5的新特性,新标签的使用,智能表单设计,引入多媒体对象,C ...
- 小强的HTML5移动开发之路(1)——HTML介绍
来自:http://blog.csdn.net/dawanganban/article/details/17591373 HTML是HyperText Markup Language(超文本标记语言) ...
随机推荐
- RFID的工作流程
工作流程 1.阅读器通过发射天线发送一定频率的射频信号, 2.当射频卡进入发射天线工作区域时产生感应电流,射频卡获得能量被激活: 3.射频卡将自身编码等信息通过卡内置发送天线发送出去 4.系统接收天线 ...
- 从头认识java-17.4 具体解释同步(3)-对象锁
这一章节我们接着上一章节的问题,给出一个解决方式:对象锁. 1.什么是对象锁? 对象锁是指Java为临界区synchronized(Object)语句指定的对象进行加锁,对象锁是独占排他锁. 2.什么 ...
- 【Java】Java Socket 通信演示样例
用socket(套接字)实现client与服务端的通信. 这里举两个样例: 第一种是每次client发送一个数据,服务端就做一个应答. (也就是要轮流发) 另外一种是client能够连续的向服务端发数 ...
- Android 继承framelayout,实现ScrollView 和 HorizontalScrollView 的效果
有些项目,需要让控件或者布局进行水平和垂直同时能拖拽,当然,ScrollView 和 HorizontalScrollView 的结合写法是一种写法.但是,这么写用户体验效果不佳,会有迟钝感,因此推荐 ...
- 利用jquery.fullPage.js 和 scrolloverflow.min.js 实现滚屏效果
参考链接:https://blog.csdn.net/c11073138/article/details/79631036 /* 按着思路去search. */
- amazeui-datatables(登录注册界面用到)
amazeui-datatables(登录注册界面用到) 一.总结 amazeui-datatables:DataTables 插件 Amaze UI 集成,只修改了样式和默认显示语言,其他参数同官方 ...
- vue使用(三)
本节目标:获取后端api数据 需求:一个按钮,点击之后将服务器上的数据获取到,并显示出来 方法一: 1. 准备工作, (1)安装官方插件 vuedemo02>npm install vue-re ...
- 关于pcb铺铜
- Oracle 排序问题(null带来的)
null 导致排序有问题, 对于数字的,一定要用nvl来解决.
- Spring 定时器 No qualifying bean of type [org.springframework.scheduling.TaskScheduler] is defined(转)
最近项目里面,用了spring的定时任务,一直以来,项目运行的不错.定时器也能正常使用.可是,今天启动项目测试的时候,盯着启动Log看了一阵子,突然间发现,启动的Log中居然有一个异常,虽然一闪而过, ...