一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

js实现二级导航功能

时间:2017-05-18 编辑:简简单单 来源:一聚教程网

效果图:

代码如下:

 

 代码如下 复制代码

 

 

 

 

  a{text-decoration: none;}

  *{margin: 0;padding: 0;box-sizing: border-box;font-family: "微软雅黑";}

  li{list-style-type: none;}

  .box{width: 220px;height: 477px;margin-top: 110px;margin-left: 100px;}

  h3{width: 100%;height: 50px;line-height: 50px;text-align: center;background: #09f;}

  h3 a{color: #FFFFFF;}

  h3 a:hover{color: deeppink;}

  ul li{width: 100%;height: 70px;line-height: 70px;border: 1px solid red;background: #09e;}

  ul li:not(:last-child){border-bottom: none;}

  ul li a{display: block;color:#FFFFFF;text-align: center;font-weight: bold;font-size: 18px;}

  ul li:hover{background: #00E8D7;}

  ul li:hover a{color: orange;}

  ul{position: relative;}

  .content{

  position: absolute;top:0;left: 220px;

  width: 800px;height: 300px;

  border: 1px solid #00FF66;

  display: none;

  }

 

 

 

 

  end():结束当前链条中最近的筛选操作,并将匹配元素还原为之前的匹配状态。

 

 

  

全部菜单

  

      

  •    一级导航

       

       11111111111111111111111111

       

      

  •   

  •    一级导航

       

       22222222222222222222222222

       

      

  •   

  •    一级导航

       

       33333333333333333333333333333

       

      

  •   

  •    一级导航

       

       44444444444444444444

       

      

  •   

  •    一级导航

       

       5555555555555555555555555555

       

      

  •   

  •    一级导航

       

       6666666666666666666666666666666666

       

      

  •   

 

 

 $(function(){

 $('ul li').hover(function(){

  $(this).find('.content').show().end().siblings().find('.content').hide();

 },function(){

  $(this).find('.content').hide();

 });

 })

 

热门栏目