a{text-decoration: none;display: block;height:30px;line-height: 30px;width:100px;
background-color:#ccc;margin-bottom: 1px;
text-align: center;
transition: width .5s;
}
a:hover{background-color: #f60;color:#fff; width: 150px;}
background-color:#ccc;margin-bottom: 1px;
text-align: center;
transition: width .5s;
}
a:hover{background-color: #f60;color:#fff; width: 150px;}
2017-03-06
最新回答 / 小生怕怕
首先这是一个鼠标放上去触发的一个事件,所以当触发的时候就会执行第一个清除定时器来清除之前的定时器,第二个定时器是在当他的宽度小于120px时,就会触发第二个清除定时器。
2017-03-06
已采纳回答 / 徐佩里翁
offsetWidth 应该是设置a标签的宽度。This.style.width=This.offsetWidth+8+"px"; /*当鼠标点击的时,宽度增加8个像素*/ if(This.offsetWidth>=160) /*宽度最大增加到160.即宽度到达160时,停止增加*/ clearInterval(This.time); /*清除计时器*/我简单加了注释,希望能帮到你。
2017-03-02
说炫技的实在是有失公允,关键还这么多赞顶到上面来了,什么心态呢?老师的课程很切题也比较基础,课程须知也有要求,无知要加一点虚心求教才好啊。
2017-03-02
//鼠标经过一级菜单,二级菜单动画下拉显示出来
var ul=this.getElementsByTagName("ul");
ul[0].style.overflow='visible';
}
//鼠标离开菜单,二级菜单动画收缩起来。
aLi[i].onmouseout=function(){
var ul=this.getElementsByTagName("ul");
ul[0].style.overflow='hidden';
}
var ul=this.getElementsByTagName("ul");
ul[0].style.overflow='visible';
}
//鼠标离开菜单,二级菜单动画收缩起来。
aLi[i].onmouseout=function(){
var ul=this.getElementsByTagName("ul");
ul[0].style.overflow='hidden';
}