我的代码为啥不行。设置了class属性

var aLi=document.getElementsByClassName('li');

for(var i=0; i<aLi.length; i++){

aLi[i].onmouseover=function(){

  var This=this.getElementsByTagName('ul')[0];

  clearInterval(This.time)

           This.time=setInterval(function(){

                This.style.height=This.offsetHeight+8+"px";

                if(This.offsetHeight>=120){

                    clearInterval(This.time);

                }

           },30)

            //鼠标经过一级菜单,二级菜单动画下拉显示出来

}

        //鼠标离开菜单,二级菜单动画收缩起来。

aLi[i].onmouseout=function(){

 var This=this.getElementsByTagName('ul')[0];

 claerInterval(This.time);

 Thi.time=setInterval(function(){

                This.style.height=This.offsetHeight-8+"px";

                if(This.offsetHeight<=0){

                    clearInterval(This.time);

                }

           },30)

}

}

}



我要坚持11
浏览 1047回答 1
1回答

__innocence

//鼠标离开菜单,二级菜单动画收缩起来     这句话往下三行,claerInterval  这个单词写错了
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript