为了账号安全,请及时绑定邮箱和手机立即绑定

各位大神帮帮忙

我点击时里面内容不改变,还是一开始的内容,一下我根据老师写的代码

<script type="text/javascript">

$(function(){

$("#menulist").on("click","a",function(){

if($(this).hasClass("btn-active")){

$("#expandZone #closeBtn").click;

return false;

}

var  curIndex = $(this).index(),mlValue= "-"+curIndex*100 +"%";

if($("#expandZone").hasClass("active")){

$("#expandZone .expdiv").animate({maginLeft:mlValue});

}

else{

$("#expandZone .expdiv").css({marginLeft :mlValue});

$("#expandZone").animate({height:"130px"}).addClass("active");

}

$(this).addClass("btn-active").siblings().removeClass("btn-active");

return false;

});

$("#expandZone #closeBtn").on("click",function(){

$("#expandZone").animate({height:"0px"},function(){ 

$(this).removeClass("active");

$("#menulist .btn-active").removeClass("btn-active");

});

return false;

});

});

</script>


正在回答

1 回答

把最后面closeBtn的点击换成以下代码试试

$("#expandZone #closeBtn").on("click",function(){

$("#expandZone").animate({height:"0px"};

$("#expandZone").removeClass("active");

$("#menulist .btn-active").removeClass("btn-active");

});

return false;



0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
形形色色的下拉菜单
  • 参与学习       107006    人
  • 解答问题       542    个

本教程从易到难,循循渐进,运用不同技术实现动态下拉菜单

进入课程

各位大神帮帮忙

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信