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>
运行代码
复制代码
另存代码
提示:您可以先修改部分代码再运行
查看全文
相关阅读:
安卓小助手
位图切割器&位图裁剪器
OAuth2.0 的简介
多账户的统一登录方案
常用的一些SQL语句
SQL语句的优化
SpringCloud简介与5大常用组件
数据库为什么需要锁机制?有哪些锁机制?
高并发下如何优化能避免服务器压力过大?
Spring MVC 简介
原文地址:https://www.cnblogs.com/liuzhuqing/p/7480656.html
最新文章
Javascript屏蔽Backspace回退页面
Visual Studio Code创建C#项目
一些小工具
tcpsock.v2 与 ecocache
《Let's Build A Simple Interpreter》之 Golang 版
游戏开发之服务器技术选型浅析
Lua 中的 RSA 加解密实现
tcpsock for Golang
Coding for Speed 技术分享
一种简单的加解密算法
热门文章
弱交互移动游戏服务器端框架设计
迷你文件下载服务器
Unity2D 小游戏之 RocketMouse
iniutils for Golang
简易版图片蜘蛛
程序人生之杂扯篇
豆瓣电影小爬虫
几种压缩算法简单测试
使用 Python 切割图片
类传奇手游简单Demo
Copyright © 2011-2022 走看看