jQuery+CSS实现菜单滑动伸展收缩(仿淘宝)

2019-12-24,,

功能很实用,代码非常的简单


效果1.



效果2.



样式代码如下:
复制代码 代码如下:
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,br,pre,form,fieldset,input,textarea,p,blockquote,th,td{
margin:0;
padding:0
}
span{
color:#FF2B13
}
a{
text-decoration:none;
color:#515050
}
a:hover{
text-decoration:underline;
color:red
}
.box_all{
overflow:hidden;
width:350px;
font-family:"微软雅黑";
font-size:14px;
border:1px solid #EEEEEE;
border-top:2px solid #F57A04;
padding:0 0 10px 0;
margin:0 auto
}
.box{
padding-left:45px;
padding-top:5px
}
.box li{
line-height:20px;
margin-right:30px;
width:120px;
text-align:left;
float:left;
list-style-type:none
}
.boxdown{
cursor:pointer;
border:1px solid #EEEEEE;
width:60px;
height:14px;
background:#FFFFFF url(../images/down.png) no-repeat 20px;
margin-left:150px;
margin-top:-2px;
border-top:none;
margin:0 auto
}
.up{
cursor:pointer;
border:1px solid #EEEEEE;
width:60px;
height:14px;
background:#FFFFFF url(../images/up.png) no-repeat 20px;
margin-left:150px;
margin-top:-2px;
border-top:none;
margin:0 auto
}

js主要代码如下:
复制代码 代码如下:
$(document).ready(function(){
var a =$(".box ul li:gt(3):not(:last)");
a.hide();
$(".boxdown").click(function(){
if(a.is(':visible')){
a.slideUp('fast');
$(this).removeClass('up');
}else{
a.slideDown('fast').show();
$(this).addClass('up');
}
});
});

您可能感兴趣的文章:

  • jquery实现简单Tab切换菜单效果
  • 基于jQuery实现的菜单切换效果
  • jQuery实现Tab菜单滚动切换的方法
  • jQuery实现带幻灯的tab滑动切换风格菜单代码
  • 基于jQuery插件实现环形图标菜单旋转切换特效
  • jQuery实现菜单式图片滑动切换
  • 7款风格新颖的jQuery/CSS3菜单导航分享
  • jquery+css+ul模拟列表菜单具体实现思路
  • 纯CSS打造的导航菜单(附jquery版)
  • jQuery+css实现的蓝色水平二级导航菜单效果代码
  • jQuery+CSS实现简单切换菜单示例

《jQuery+CSS实现菜单滑动伸展收缩(仿淘宝).doc》

下载本文的Word格式文档,以方便收藏与打印。