accordion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | <! DOCTYPE html> < html lang="en"> < head > < meta charset="UTF-8"> < title >accordion</ title > < script src="js/jquery-1.7.1.js"></ script > < script src="js/sqLib.js"></ script > < style > .accordion-panel{ width: 400px; } .accordion-panel-heading{ color: #d74147; width: 400px; height: 40px; line-height: 40px; border: 1px solid #d74147; margin: 5px 0; padding-left: 10px; border-radius: 5px; } .accordion-panel-content{ display: none; border: 1px solid #000; width: 400px; border-radius: 5px; padding-left: 10px; line-height: 40px; } </ style > < script > $(function(){ $('.accordion-panel-heading').on('click',function(){ if($(this).hasClass('active')) { $(this).removeClass('active'); $(this).siblings('.accordion-panel-content').slideUp('slow'); } else { $('.accordion .accordion-panel-heading').removeClass('active'); $('.accordion .accordion-panel-content').slideUp('slow'); $(this).addClass('active'); $(this).siblings('.accordion-panel-content').slideDown('slow'); } }); }); </ script > </ head > < body > < div class="accordion"> < div class="accordion-panel"> < div class="accordion-panel-heading">标题1</ div > < div class="accordion-panel-content">内容1</ div > </ div > < div class="accordion-panel"> < div class="accordion-panel-heading">标题2</ div > < div class="accordion-panel-content">内容2</ div > </ div > < div class="accordion-panel"> < div class="accordion-panel-heading">标题3</ div > < div class="accordion-panel-content">内容3</ div > </ div > < div class="accordion-panel"> < div class="accordion-panel-heading">标题4</ div > < div class="accordion-panel-content">内容4</ div > </ div > </ div > </ body > </ html > |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET 9 new features-C#13新的锁类型和语义
· Linux系统下SQL Server数据库镜像配置全流程详解
· 现代计算机视觉入门之:什么是视频
· 你所不知道的 C/C++ 宏知识
· 聊一聊 操作系统蓝屏 c0000102 的故障分析
· 不到万不得已,千万不要去外包
· C# WebAPI 插件热插拔(持续更新中)
· .NET 9 new features-C#13新的锁类型和语义
· 会议真的有必要吗?我们产品开发9年了,但从来没开过会
· 《SpringBoot》EasyExcel实现百万数据的导入导出