zoukankan
html css js c++ java
JQUERY 展开收起显示隐藏效果
<!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> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <title>jquery 收缩展开效果</title> <script type="text/javascript" src="http://www.mengdongli.com/skins/2012/js/jquery1.3.2.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"); //}); $("div.text").hide();//默认隐藏div,或者在样式表中添加.text{display:none},推荐使用后者 $(".box h1").click(function(){ $(this).next(".text").slideToggle("slow"); }) }); </script> <!-- 收缩展开效果 --> <div class="box"> <h1>收缩展开效果</h1> <div class="text"> 1<br /> 2<br /> 3<br /> 4<br /> 5<br /> </div> </div> <br /> <div class="box"> <h1>收缩展开效果</h1> <div class="text"> 1<br /> 2<br /> </div> </div> <br> 第一次运行请刷新一下页面。 </body> </html>
运行代码
复制代码
另存代码
提示:您可以先修改部分代码再运行
查看全文
相关阅读:
AcWing算法提高课【第二章搜索1】Flood Fill、最短路模型
数论 01_博弈论
动态规划【DP】
AcWing算法提高课【第一章动态规划3】背包模型
AcWing算法提高课【第一章动态规划2】最长上升子序列模型
bazel remote executor--- buildfarm
编译加速 remote cache
Linux系统中"动态库"
docker实践
realtime guard stock
原文地址:https://www.cnblogs.com/liuzhuqing/p/7480656.html
最新文章
debian添加用户名到sudoers文件
系统安装list
CLion快捷键设置
工具
ROS开发--在订阅话题的回调函数中发布话题
Eigen库学习---Map类
pcl库卸载再重装
cartographer保存地图
ros下怎么查看usb设备在哪个端口
u盘变成Read-only file system
热门文章
ROS学习--RViz使用的要点
union数据转换 & 四字节转float
QT开发——动态库/静态库的生成与调用(Qmake和Cmake方式)
QT开发——UI根据屏幕大小等比例缩放
QT开发——鼠标和键盘事件
QT开发——QMessageBox添加倒计时
ROS环境读写yaml文件以及数组操作
博客园美化教程收集(亲测有效)
FireFox浏览器的tips
AcWing算法提高课【第四章高级数据结构】线段树
Copyright © 2011-2022 走看看