各位大神幫幫忙
我點擊時里面內(nèi)容不改變,還是一開始的內(nèi)容,一下我根據(jù)老師寫的代碼
<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>
2019-02-08
把最后面closeBtn的點擊換成以下代碼試試
$("#expandZone #closeBtn").on("click",function(){
$("#expandZone").animate({height:"0px"};
$("#expandZone").removeClass("active");
$("#menulist .btn-active").removeClass("btn-active");
});
return false;