仿天猫购物街品牌展示效果


 

<!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>
body{
  background-color:#eee;
}
*{
  margin:0;
  padding:0;
}
#outDiv{
  width:190px;
  margin-left:10px;
  margin-top:10px;
  position:relative;
}
#top1{
  height:30px;
  background-color:#000;
  color:#fff;
  line-height:30px;
  padding-left:10px;
  font-weight:bold;
}
#top2{
  cursor:pointer;
}
#top3{
  background-color:#000;
  line-height:30px;
  height:30px;
  width:190px;
  opacity:0.5;
  filter:alpha(opacity=50);
  position:absolute;
  bottom:-30px;
  cursor:pointer;
}
#top4{
  color:#fff;
  line-height:30px;
  height:30px;
  width:190px;
  position:absolute;
  bottom:-30px;
  cursor:pointer;
}
#top4 .brand_focus1{
 position:absolute;
 right:10px;
 display:inline-block;
}
#top4 .brand_name{
 position:absolute;
 left:10px;
 display:inline-block;
}
ul{
  list-style-type:none;
}
li{
  width:86px;
  height:45px;
  float:left;
  border:1px solid #fff;
  border-bottom:1px #CCC dotted;
  padding-top:5px;
  padding-bottom:5px;
  background-color:#fff;
  display:block;
  position:relative;
}
.even_li{
  padding-right:7px;
  border-right:1px dotted #ccc;
}
#bottom .ord_li{
  padding-right:7px;
}
.logo_img{
  background-image:url(small_imgs.gif);
  background-repeat:no-repeat;
  width:90px;
  height:45px;
  display:block;
}
.brand_focus2{
  display:none;
  background-color:#ddd;
  height:25px;
  width:83px;
  padding-left:10px;
  line-height:25px;
  display:none;
  border:1px solid #999;
  position:absolute;
  left:-1px;
  z-index:999;
}
.active{
  top:-15px;
  border:1px solid #999;
  cursor:pointer;
}
</style>
</head>

<body>
<div id="outDiv">
  <div id="top">
     <div id="top1">产品分类</div>
  <div id="top2"><img src="big_img.jpg" border="0" /></div>
  <div id="top3"></div>  <!--实现透明背景上文字不透明效果,增加了“top3”-->
  <div id="top4">
     <a>
        <b class="brand_name">品牌名称</b>
     <b class="brand_focus1">+关注</b>
  </a>
  </div>
  </div>
  <ul id="bottom">
    <li class="even_li">
   <a>
     <span>
     <b class="logo_img" style="background-position:0 0"></b>
  </span>
  <span>
     <b class="brand_focus2">+关注</b>
  </span>
   </a>
 </li>
 <li class="ord_li">
   <a>
     <span>
     <b class="logo_img" style="background-position:0 -45px"></b>
  </span>
  <span>
     <b class="brand_focus2">+关注</b>
  </span>
   </a>
 </li>
 <li class="even_li">
   <a>
     <span>
     <b class="logo_img" style="background-position:0 -90px"></b>
  </span>
  <span>
     <b class="brand_focus2">+关注</b>
  </span>
   </a>
 </li>
 <li class="ord_li">
   <a>
     <span>
     <b class="logo_img" style="background-position:0 -135px"></b>
  </span>
  <span>
     <b class="brand_focus2">+关注</b>
  </span>
   </a>
 </li>
 <li class="even_li">
   <a>
     <span>
     <b class="logo_img" style="background-position:0 -180px"></b>
  </span>
  <span>
     <b class="brand_focus2">+关注</b>
  </span>
   </a>
 </li>
 <li class="ord_li">
   <a>
     <span>
     <b class="logo_img" style="background-position:0 -225px"></b>
  </span>
  <span>
     <b class="brand_focus2">+关注</b>
  </span>
   </a>
 </li>
 <li class="even_li">
   <a>
     <span>
     <b class="logo_img" style="background-position:0 -270px"></b>
  </span>
  <span>
     <b class="brand_focus2">+关注</b>
  </span>
   </a>
 </li>
 <li class="ord_li">
   <a>
     <span>
     <b class="logo_img" style="background-position:0 -315px"></b>
  </span>
  <span>
     <b class="brand_focus2">+关注</b>
  </span>
   </a>
 </li>
  </ul>
</div>
<script>
/*
* 仿天猫品牌街品牌展示;
* ie8,ff,chrome浏览器中测试通过,其余浏览器未测;
* *******made by keimon*********
* *********2013-01-09***********
*/
//鼠标移动到品牌logo上时,突出显示品牌logo
var len = $('#bottom li').length;
for(var i=0; i<len; i++){
   $('#bottom li').eq(i).hover(function(){
      var itemLi = $(this);
   var index = $('#bottom li').index(itemLi);
   $('#bottom li').eq(index).find('.brand_focus2').css('display','block');
   $('#bottom li').eq(index).addClass('active');
   },function(){
      var itemLi = $(this);
   var index = $('#bottom li').index(itemLi);
   $('#bottom li').eq(index).removeClass('active');
   $('#bottom li').eq(index).find('.brand_focus2').css('display','none');
   })
}

/*
*  要实现透明背景上文字不透明,用了两个div(top3,top4)
*/
//大图片上透明背景,及图片的加载;
var timer1,timer2;
$('#top2').hover(function(){
      if($('#top3').css('bottom')=='0px'){
      clearTimeout(timer2)
      $('#top3').add($('#top4')).css('bottom','0px');
   }else{
         $('#top3').add($('#top4')).animate({bottom:'0px'},200);
   }
   },function(){
      timer1 = setTimeout(function(){
         $('#top3').add($('#top4')).animate({bottom:'-30px'},200);
      },300)
})

$('#top4').hover(function(){
     clearTimeout(timer1);
     $('#top3').add($('#top4')).css('bottom','0px');
},function(){
  timer2 = setTimeout(function(){
    $('#top3').add($('#top4')).animate({bottom:'-30px'},200);
  },300)
})

 

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值