jQuery实现类似QQ下拉菜单式的效果
来源:互联网 发布:淘宝店铺诊断分析报告 编辑:程序博客网 时间:2024/05/17 01:52
导读:画图很蛋疼,所以还是使用css做一个。刚学的写的很纠结。希望大牛不要介意。
效果图:
全部代码:
<!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></title>
<style type="text/css">
*
{
margin: 0;
padding: 0;
}
body
{
font-size: 15px;
padding: 100px;
}
.menu
{
width: 500px;
border-bottom: solid 1px gray;
}
.menu h3
{
border: solid 1px gray;
height: 30px;
line-height: 30px;
padding-left: 10px;
padding: 0 5px;
border-bottom: none;
cursor: pointer;
}
.menu p
{
border-left: solid 1px gray;
border-right: solid 1px gray;
padding: 5px 0;
padding-left: 5px;
}
.changecolor{background-color:red;}
</style>
<script src="js/jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$(".menu p:not(:first)").hide();
$(".menu h3").css("background", "#ccc");
// $(".menu h3").hover(function () { $(this).addClass("changecolor"); }, function () { $(this).removeClass("changecolor"); });
// $(".menu h3").click(function () { $(this).css("background", "red").next("p").show().siblings().hide(); });
$(".menu h3").hover(function () { $(this).css("background-color", "gray").siblings("h3").css("background-color", "#ccc"); })
$(".menu h3").mouseleave(function () { $(".menu h3").css("background", "#ccc") }); //离开时将其变为原来颜色
var index = $(".menu h3").index(this);
$(".menu h3").click(function () { $(this).next("p").slideToggle().siblings("p").slideUp(); });
});
</script>
</head>
<body>
<div class="menu">
<h3>
我的好友</h3>
<p>
周杰伦<br />
温家宝</p>
<h3>
我的朋友</h3>
<p>
李连杰<br />
本拉登</p>
<h3>
陌生人</h3>
<p>
比尔盖茨<br />
阿娇</p>
</div>
</body>
</html>
<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- JQuery实现类似QQ下拉菜单式的效果
- jQuery实现类似QQ下拉菜单式的效果
- jquery实现可以左右选择的下拉菜单效果
- jQuery slideToggle轻松实现效果不错的垂直下拉菜单
- jQuery实现两个下拉菜单的选项互相移动效果
- jQuery slideToggle轻松实现效果不错的垂直下拉菜单
- 类似百叶窗下拉菜单效果
- jquery实现二级菜单下拉效果
- jquery实现二级导航下拉菜单效果
- 实现类似美团的下拉分级式菜单
- Jquery实现的下拉菜单
- jquery 实现菜单的下拉菜单
- 类似QQ的新闻图展的JQuery效果
- 实现左右移动的下拉菜单效果
- 使用JavaScript实现下拉菜单的效果
- 类似QQ管家会员页面的jquery轮换效果
- JQuery网页下拉菜单效果
- Jquery 下拉菜单动画效果
- 2440 norflash 启动进不了中断解决
- merge json (incomplete)
- Part2:The CImage Class & Displaying Animations
- django总结
- 本文章用于记录平常所遇到的问题以及解决方法
- jQuery实现类似QQ下拉菜单式的效果
- C语言中access函数
- Git 介绍 ppt
- 字符串匹配算法
- jsp中url传递中文参数乱码的暂时解决方案
- 问题一百:求数列之和
- NS2完整的流程简介
- 泛型浅析
- _access在unicode字符集下的问题。。