jquery实现左侧菜单 效果
html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>左侧菜单</title>
<script type="text/javascript" src="js/jquery-3.0.0.min.js" ></script>
<script type="text/javascript" src="js/test.js" ></script>
<style>
* { padding:0; margin:0; } body { padding:100px; font:12px "宋体"; } .box { width:500px; border-bottom:1px solid #CCC; } .box h1 { height:30px; line-height:30px; padding:0 10px; font-size:12px; cursor:pointer; border:1px solid #ccc; border-bottom:none; background:#3c3c3c url(img/bg.gif) no-repeat right -27px; color:white} .box h1.hover { background-color:#9d9d9d; } .box h1.active { background-position:right 7px; } .box p { padding:10px; border-left:1px solid #ccc; border-right:1px solid #ccc; } </style> </style>
</head>
<body> <div class="box">
<h1>标题1</h1>
<p>Beauty without virtue is a rose without fragrance.无德之美犹如没有香味的玫瑰,徒有其表。</p>
<h1>标题1</h1>
<p>well begun,half done.好的开始等于成功的一半。</p>
<h1>标题1</h1>
<P>live not to eat,but eat to live.活着不是为了吃饭,吃饭为了活着。</P>
<h1>标题1</h1>
<p>It is hard to please all.众口难调。</p>
</div>
</body>
</html>
js
$(document).ready(function(){
$('.box h1:first').addClass('active');
$('.box p:not(:first)').hide();
$('.box h1').hover(function(){
$(this).addClass('hover');
},function(){
$(this).removeClass('hover');
});
$('.box h1').click(function(){
$(this).next('p').slideToggle().siblings('p').slideUp();
$(this).toggleClass('active')
.siblings('h1').removeClass('active');
});
});
图片:

效果:

2017-09-25 09:44:24
jquery实现左侧菜单 效果的更多相关文章
- 翻遍互联网都找不到的解决方案,一行代码轻松实现 Gitbook 默认折叠左侧菜单效果
Gitbook 是一款产品文档构建工具,也可以用于构建个人博客,默认情况下电脑端访问时左侧菜单是展开状态,可偏偏有人想要实现默认折叠效果,于是诞生了这篇文章! 善良的我选择帮助别人 可能是网上关于 G ...
- jquery 仿windows10菜单效果下载
http://www.kuitao8.com/20150923/4079.shtml jquery 仿windows10菜单效果下载
- python : jquery实现左侧菜单
左侧菜单 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3 ...
- JQuery之左侧菜单
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 权限模块_使用权限_实现主页面的效果_显示左侧菜单&只显示有权限的菜单项
权限模块__使用权限__实现主页面的效果 HomeAction.java public class HomeAction extends ActionSupport { public String i ...
- jQuery Wheel 环形菜单插件5种效果演示
很酷的菜单-jQuery Wheel 环形菜单插件5种效果演示在线预览 下载地址 实例代码 <div class="container"> <!-- Top Na ...
- jquery左侧菜单
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 亚马逊左侧菜单延迟z三角 jquery插件jquery.menu-aim.js源码解读
关于亚马逊的左侧菜单延迟,之前一直不知道它的实现原理.梦神提到了z三角,我也不知道这是什么东西.13号那天很有空,等领导们签字完我就可以走了.下午的时候,找到了一篇博客:http://jayuh.co ...
- C# WPF 左侧菜单右侧内容布局效果实现
原文:C# WPF 左侧菜单右侧内容布局效果实现 我们要做的效果是这样的,左侧是可折叠的菜单栏,右侧是内容区域,点击左侧的菜单项右侧内容区域则相应地切换. wpf实现的话,我的办法是用一个tabcon ...
随机推荐
- html5 像素模拟渐变
代码实例: <!DOCTYPE html> <html> <head> <style> canvas{ background:#eee; } </ ...
- 01.java8入门
函数式编程的不变模式 import java.util.Arrays; /** * 函数式编程的不变模式 */ public class ArrStream { public static void ...
- Factory Methods
The static factory method pattern is a way to encapsulate object creation. Without a factory method, ...
- Using If/Truth Statements with pandas
pandas follows the numpy convention of raising an error when you try to convert something to a bool. ...
- pytest 教程
https://blog.csdn.net/lb245557472/article/details/90341297 https://blog.csdn.net/yyang3121/article/d ...
- PCB学习
一.PCB设置 在线DRC:自动更正,会提示短路. 对象捕捉>>智能元件snap,可以智能抓取中心点,勾选 智能TrackEnds: 撤销重做:30步 旋转步骤:90.000(可以按空格旋 ...
- JS中数据结构之集合
集合(set)是一种包含不同元素的数据结构.集合中的元素称为成员.集合的两个最重要特性是:首先,集合中的成员是无序的:其次,集合中不允许相同成员存在.当你想要创建一个数据结构用来保存一些独一无二的元素 ...
- 2019.6.1 模拟赛——[ 费用流 ][ 数位DP ][ 计算几何 ]
第一题:http://codeforces.com/contest/1061/problem/E 把点集分成不相交的,然后跑费用流即可.然而错了一个点. #include<cstdio> ...
- 使用Android Studio打出apk包
参考: Android Studio 超级简单的打包生成apk https://blog.csdn.net/hefeng6500/article/details/79869647 为什么要打包: ap ...
- TestStack.White安装详解
一.安装 NuGet TestStack.White是通过NuGet进行安装的.NuGet最低支持VS2010.我使用的VS2015. 安装方式一 :从Visual Studio的工具->扩展和 ...