jQuery Mobile(jqm)button的隐藏和显示,包含a标签,圆角和非圆角button
在移动互联网时代,HTML5开发越来越收到欢迎。
于是各种HTML5的框架都出来了。因为对于jquery的熟悉,jquery mobile 为多数人选择学习的对象。我也是众多追求者之中的一个。近期一直在开发jQuery Mobile的相关应用。
并颇有心得。再这里和大家一起分享一下。
好了,我们之间上代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>如有不懂。请加qq群:135430763,共同学习! </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.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head> <body>
<div data-role="page" id="page" data-theme="b">
<div data-role="header" data-position="fixed" data-theme="b">
<h1>
如有不懂,请加qq群:135430763。共同学习! </h1>
<a href="javascript:location.reload();" data-role="button" class="ui-btn-right" data-icon="refresh">刷新</a>
</div> <div data-role="content">
<p>
点击button2。隐藏button1。而且将button2改为圆角
</p><p>
点击button3。显示button1,而且将button2改为非圆角
</p>
<p>
如有不懂,请加qq群:135430763。共同学习! </p>
<p>
如有不懂,请加qq群:135430763,共同学习。
</p>
<p>
如有不懂。请加qq群:135430763,共同学习!
</p>
<p>
如有不懂,请加qq群:135430763,共同学习! </p> <div data-role="controlgroup" data-type="horizontal">
<input type="button" value="我是button1" data-inline="true" id="btn1">
<input type="button" value="我是button2" data-inline="true" id="btn2">
<input type="button" value="我是button3" data-inline="true" id="btn3">
</div> <p>
点击button5,隐藏button4。而且将button5改为圆角
</p>
<p>
点击button6,显示button4,而且将button5改为非圆角
</p> <div data-role="controlgroup" data-type="horizontal">
<a href="#" data-role="button" id="a4">我是button4</a>
<a href="#" data-role="button" id="a5" onclick="hideA();return false;">我是button5</a>
<a href="#" data-role="button" id="a6" onclick="showA();return false;">我是button6</a>
</div>
</div> <div data-role="footer" data-position="fixed" data-theme="b">
<span style="height: 40px; line-height: 40px; text-align: center; display: block; font-size: 9px;">如有不懂,请加qq群:135430763,共同学习!</span>
</div>
</div>
<script type="text/javascript">
//给button2绑定click事件
$('#btn2').unbind().bind('click',function(){
//隐藏button1
$('#btn1').parent("div").css('display','none');
//给button2加入样式,使button2变成圆角
$('#btn2').parent("div").addClass('ui-first-child');
});
//给button3绑定click事件
$('#btn3').unbind().bind('click',function(){
//隐藏button1
$('#btn1').parent("div").css('display','');
//给button2减去ui-first-child样式
$('#btn2').parent("div").removeClass('ui-first-child');
}); //a5标签的onclick事件
function hideA(){
$('#a4').css('display','none');
//给a5标签加入样式,使a5标签变成圆角
$('#a5').addClass('ui-first-child');
} //a6标签的onclick事件
function showA(){
$('#a4').css('display','');
//给a5标签删除样式,使a5标签变成非圆角
$('#a5').removeClass('ui-first-child');
} </script> </body>
</html>
在看看执行效果:
更具体的学习资料,请点击下载:http://download.csdn.net/download/xmt1139057136/7447463
欢迎大家关注我的个人博客,如有不懂,请加qq群:135430763进行共同学习!
jQuery Mobile(jqm)button的隐藏和显示,包含a标签,圆角和非圆角button的更多相关文章
- jquery mobile 请求数据方法执行时显示加载中提示框
在jquery mobile开发中,经常需要调用ajax方法,异步获取数据,如果异步获取数据方法由于网速等等的原因,会有一个反应时间,如果能在点击按钮后数据处理期间,给一个正在加载的提示,客户体验会更 ...
- jquery动画(控制动画隐藏、显示时间轴)
<!DOCTYPE html><html> <head> <meta http-equiv="Content-type" conte ...
- jQuery Mobile学习之grid、等待显示的ajax效果、页面跳转、页面跳转传递参数等(二)
Index.cshtml <!-- Start of second page --> <section data-role="page" id="bar ...
- jQuery关于复制(复制隐藏文字+显示文字)跳转,Clipboard
html: (直接上扎实的数据,框子自己搭建) <script type="text/javascript" src="../../js/jquery.min.js ...
- jQuery 学习02——效果:隐藏/显示、淡入淡出、滑动、动画、停止动画、Callback、链
jQuery 效果- 隐藏hide()和显示show() 语法: $(selector).hide(speed,callback);$(selector).show(speed,callback); ...
- jquery的隐藏与显示
###显示与隐藏,通过用hide()和show()函数来实现 语法: $(selector).hide(speed,callback); $(selector).show(speed,callback ...
- jquery mobile将页面内容当成弹框进行显示
注:必须使用相对应版本的jquery mobile css.不然无法正常显示 <div data-role="page" id="pageone"> ...
- 经典收藏 50个jQuery Mobile开发技巧集萃
http://www.cnblogs.com/chu888chu888/archive/2011/11/10/2244181.html 1.Backbone移动实例 这是在Safari中运行的一款Ba ...
- (转)经典收藏 50个jQuery Mobile开发技巧集萃
(原)http://www.cnblogs.com/chu888chu888/archive/2011/11/10/2244181.html 经典收藏 50个jQuery Mobile开发技巧集萃 ...
随机推荐
- 使用Swift和SpriteKit写一个忍者游戏
这篇文章的游戏使用SpriteKit和Swift语言来完毕. SpriteKit是苹果自己的游戏引擎,更能贴合iOS系统底层的API,只是架构和实现上都是模仿了Cocos2D.所以使用上事实上区别不大 ...
- poj - 1159 - Palindrome(滚动数组dp)
题意:一个长为N的字符串( 3 <= N <= 5000).问最少插入多少个字符使其变成回文串. 题目链接:http://poj.org/problem?id=1159 -->> ...
- 2015.05.04,外语,读书笔记-《Word Power Made Easy》 14 “如何谈论日常现象” SESSION 41
1. people are the craziest animals bovine(['bәuvain] adj. (似)牛的, 迟钝的),像牛一样placid(['plæsid] adj. 安静的, ...
- Linux目录结构(一)
linux文件系统的最顶端是/,称为linux的root,所有的目录.文件.设备都在/之下. 文件类型 linux有四种基本文件系统类型:普通文件.目录文件.连续文件和特殊文件.可以用file命令来识 ...
- js正则获取html字符串指定的dom元素和内容
var str = "<div>111<p id='abc'>3333</p></div><div>222<div id=' ...
- 杭电 2639 Bone Collector II【01背包第k优解】
解题思路:对于01背包的状态转移方程式f[v]=max(f[v],f[v-c[i]+w[i]]);其实01背包记录了每一个装法的背包值,但是在01背包中我们通常求的是最优解, 即为取的是f[v],f[ ...
- ng-repeat 中的 track by $index
用ng-repeat指令遍历一个javascript数组,当数组中有重复元素的时候,angularjs会报错,这是因为ng-Repeat不允许collection中存在两个相同Id的对象. 对于数字或 ...
- mac下生成ssh key
ssh -v usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec] [-D [bind_address: ...
- 前端dom操作竟然使得http请求的时间延长了
最近在项目中遇到了一个奇怪的问题:在google浏览器的调试窗口network下看到一个请求的时间一直是2s多,但是当我把这个请求单独拿出来执行的时候发现根本用不了2s,100多毫秒就完成了.最后再不 ...
- zabbix监控自身为监控机(server)
Zabbix 监控主机 添加自身为被监控机 这里我的环境已经部署完毕(没有经验的小伙伴可以看我上一篇文章) 等待一会刷新如下页面 字体出现以下亮度就成功了