简单侧边菜单

 

<!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=gb2312" />
<title>无标题文档</title>
<script type="text/javascript" src="jquery-1.8.3.js"></script>
<style>
a{
  text-decoration:none;
  color:#000;
}
ul{
  list-style:none;
  padding:0;
  margin:0;
}
#hid1, .carBrand{
  display:none;
}
#out{
  position:relative;
}
#out span{
  width:100px;
  height:30px;
  background:#eee;
  display:block;
  line-height:30px;
  text-align:center;
  position:absolute;
  border:1px solid #000;
  z-index:2;
}
#hid1{
  width:200px;
  height:200px;
  background-color:#eee;
  position:absolute;
  z-index:1;
  top:30px;
  border:1px solid #000;
}
#hid1 div{
  margin-top:15px;
  width:100px;
  height:30px;
  border: 1px solid #FFF;
  line-height:30px;
  text-align:center;
  position:relative;
  z-index:4;
  background-color:#eee;
}
#hid1 div.hover{
  background-color:#ddd;
}
.carBrand{
   width:90px;
   height:80px;
   border:1px solid #fff;
   position:absolute;
   left:100px;
   padding-top:10px;
   background:#ddd;
   z-index:3
}
.carBrand li{
   width:90px;
   text-align:center;
   line-height:25px;
   height:25px;
}
.carBrand li a:hover{
   color:blue;
}
</style>
</head>

<body>
<div id="out">
    <span><a href="#">汽车</a></span>
    <div id="hid1">
    <ul>
       <li class="carPlace">
      <div><a href="#">欧美车1</a></div>
            <ul class="carBrand" style="top:10px">
               <li><a href="#">福特1</a></li>
               <li><a href="#">奥迪1</a></li>
               <li><a href="#">宾利1</a></li>
             </ul>
    </li>
    <li class="carPlace">
      <div><a href="#">欧美车2</a></div>
            <ul class="carBrand" style="top:30px;">
               <li><a href="#">福特2</a></li>
               <li><a href="#">奥迪2</a></li>
               <li><a href="#">宾利2</a></li>
             </ul>
    </li>
    <li class="carPlace">
      <div><a href="#">欧美车3</a></div>
            <ul class="carBrand" style="top:60px;">
               <li><a href="#">福特3</a></li>
               <li><a href="#">奥迪3</a></li>
               <li><a href="#">宾利3</a></li>
             </ul>
    </li>
    </ul>
    </div>
</div>
<script>
$('#out').hover(function(){
   var timer = setTimeout(function(){
      $('#out span').css('borderBottom','none')
      $('#hid1').show();
   },300)  
}, function(){
   var timer = setTimeout(function(){
      $('#out span').css('borderBottom','1px solid #000')
      $('#hid1').hide();
   },300)  
})

var liLen = $('.carPlace').length;
for(var i=0; i<liLen; i++){
   $('.carPlace').eq(i).hover(function(){
      var hoverLi = $(this);
   hoverLi.find('div').css('borderRight','none').addClass('hover');
   hoverLi.find('ul').show();
   },function(){
      var hoverLi = $(this);
   hoverLi.find('div').css('borderRight','1px solid #fff').removeClass('hover');
   hoverLi.find('ul').hide();
   })
}

</script>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值