点击展开收缩
2012-10-08 16:43
120 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery实现DIV层的收缩展开效果_网页代码站(www.webdm.cn)</title>
<script type="text/javascript" src="http://www.webdm.cn/themes/script/jquery.js"></script>
<style>
/* 收缩展开效果 */
.text{line-height:22px;padding:0 6px;color:#666;}
.box h1{padding-left:10px;height:22px;line-height:22px;background:#f1f1f1;font-weight:bold;}
.box{position:relative;border:1px solid #e7e7e7;}
</style>
</head>
<body>
<script type="text/javascript">
// 收缩展开效果
$(document).ready(function(){
$(".box h1").toggle(function(){
$(this).next(".text").animate({height: 'toggle', opacity: 'toggle'}, "slow");
},function(){
$(this).next(".text").animate({height: 'toggle', opacity: 'toggle'}, "slow");
});
});
</script>
<!-- 收缩展开效果 -->
<div class="box">
<h1>收缩展开效果</h1>
<div class="text">
1<br />
2<br />
</div>
</div>
<br />
第一次运行请刷新一下页面。
<br />
<p><a href="http://gzlvt.taobao.com">婷之馨</a></p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery实现DIV层的收缩展开效果_网页代码站(www.webdm.cn)</title>
<script type="text/javascript" src="http://www.webdm.cn/themes/script/jquery.js"></script>
<style>
/* 收缩展开效果 */
.text{line-height:22px;padding:0 6px;color:#666;}
.box h1{padding-left:10px;height:22px;line-height:22px;background:#f1f1f1;font-weight:bold;}
.box{position:relative;border:1px solid #e7e7e7;}
</style>
</head>
<body>
<script type="text/javascript">
// 收缩展开效果
$(document).ready(function(){
$(".box h1").toggle(function(){
$(this).next(".text").animate({height: 'toggle', opacity: 'toggle'}, "slow");
},function(){
$(this).next(".text").animate({height: 'toggle', opacity: 'toggle'}, "slow");
});
});
</script>
<!-- 收缩展开效果 -->
<div class="box">
<h1>收缩展开效果</h1>
<div class="text">
1<br />
2<br />
</div>
</div>
<br />
第一次运行请刷新一下页面。
<br />
<p><a href="http://gzlvt.taobao.com">婷之馨</a></p>
</body>
</html>
相关文章推荐
- DIV结构的点击收缩展开左边栏代码(html+css+js)
- Easyui tree 点击展开收缩
- JS jquery 菜单栏点击展开 收缩 基于UC浏览器主页的顶端实现
- 用UICollectionView实现点击展开收缩的cell
- jQuery插件treeview点击节点名称不展开、收缩节点 分类: JavaScript 2014-06-16 20:28 539人阅读 评论(0) 收藏
- ExpandableListView的首次加载全部展开,并且点击Group不收缩、
- 关于cell点击展开收缩的总结
- jQuery插件treeview点击节点名称不展开、收缩节点 分类: JavaScript 2014-06-16 20:28 540人阅读 评论(0) 收藏
- 悬浮窗,点击收缩/展开
- 点击UITableView的cell展开收缩
- java 中实现象开发环境中那样,需要某些面板时点击展开,不需要时点击让其收缩
- 一般左边后台点击收缩展开的效果
- 点击展开收缩
- TreeView的TreeNode点击展示展开和收缩的效果
- jQuery插件treeview点击节点名称不展开、收缩节点
- ExtJs中实现tree节点,全部是单击展开和收缩效果,和收藏夹点击功能一样
- 层点击可以展开(打开),再次点击关闭(收缩)
- 利用ExpandableListViewAdapter 点击父节点,无法进行展开和收缩
- js点击收缩展开文本
- 点击展开再点收缩文本的效果