最后的切换效果不正常,各位前辈能帮我看看怎么回事吗?
相关代码
.search-list li{
display: none;
height: 39px;
line-height: 39px;
overflow: hidden;
text-align: center;/*文字居中*/
}
.search-list li a{
color: #6c6c6c;
}
.search-list .selected {
background:#f6f6f6;/*高亮效果*/
display: block;
}
.trigger-hover{
height: auto;
}
.trigger-hover li{
display: block;
}
addEvent('search_tab','mouseover',function(){
this.className+=' trigger-hover';//类名trigger-hover前面要加空格
});
//鼠标移入高亮效果
addEvent('tab_1','mouseover',function(){
if(this.className.indexOf('selected')<0){
this.className+=' selected';
}
});
addEvent('tab_1','mouseout',function(){
this.className='';
});
//选中文本替换 1 把列表收起来 2没选中的隐藏
addEvent('tab_1','click',function(){
getDOM('search_tab').className='search-list';
});
addEvent('tab_2','click',function(){
getDOM('search_tab').className='search-list';
});
addEvent('tab_2','mouseover',function(){
if(this.className.indexOf('selected')<0){
this.className+=' selected';
}
});
addEvent('tab_2','mouseout',function(){
this.className='';
});