控制面板 - 帮助中心 - 付款方式 - 常用文档 - 软件下载 -   
服务中心
当前位置:首页 - 服务中心 - 网络学院

jQuery简单的下拉菜单效果

  一个简单的下拉菜单效果,主要用于说明jQuery的web用法,直接贴出源代码:

<!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>简单的下拉菜单效果</title>

<script type="text/javascript" src="/upimg/files/jquery-1.4.2.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){

 $(".btn-slide").click(function(){
  $("#panel").slideToggle("slow");
  $(this).toggleClass("active"); return false;
 });
 
 
});
</script>

<style type="text/css">
body {
 margin: 0 auto;
 padding: 0;
 width: 570px;
 font: 75%/120% Arial, Helvetica, sans-serif;
}
a:focus {
 outline: none;
}
#panel {
 background: #754c24;
 height: 200px;
 display: none;
}
.slide {
 margin: 0;
 padding: 0;
 border-top: solid 4px #422410;
 background: url(/upimg/2010/201058184527643.gif) no-repeat center top;
}
.btn-slide {
 background: url(/upimg/2010/201058184553359.gif) no-repeat right -50px;
 text-align: center;
 width: 144px;
 height: 31px;
 padding: 10px 10px 0 0;
 margin: 0 auto;
 display: block;
 font: bold 120%/100% Arial, Helvetica, sans-serif;
 color: #fff;
 text-decoration: none;
}
.active {
 background-position: right 12px;
}
</style>
</head>

<body>

<div id="panel">
 这就是下拉效果,很简单吧!
</div>

<p class="slide"><a href="#" class="btn-slide">Slide Panel</a></p>

</body>
</html>

   提示:点击运行代码按钮可看到实际效果

更新时间:2010-5-8

7*24小时咨询热线:400-628-6536 0371-86013552 19937165195
传真:0371-86013552-6612 服务邮箱:web@3a88.com 代理邮箱:agent@3a88.com 备案邮箱:beian@3a88.com
运营商:郑州金飞科技有限公司 工商营业执照号:9141010567945717XL
公司地址:郑州高新技术产业开发区木兰里9号1号楼1单元14层310号 邮政编码:450000 豫ICP备12025635号-1 豫公网安备 41010502003077号