JS,移动到文字上显示一个div层,然后鼠标可以移到这个div层,当鼠标不在div层时,div层会自动隐藏
2个回答
展开全部
代码我已经拿到了.现在把修改后的第二段JS贴给你.
<script type='text/javascript'>
var category=$('J_category'),popCategory=$('J_popCategory');
var cateLi=category.getElementsByTagName('li'),subItems=getElementsByClassName('sub-item','div');
var v=true;
category.onmouseover=function(){popCategory.style.display='block';};
category.onmouseout=function(){popclose();};
popCategory.onmouseover=function(){v=true;};
popCategory.onmouseout=function(){popclose();};
for(var i=0; i<cateLi.length; i++){
cateLi[i].index=i;
cateLi[i].onmouseover=function(){
for(var j=0; j<subItems.length; j++){
subItems[j].style.display='none';
}
subItems[this.index].style.display='block';
v=true;
};
}
function popclose(){
v=false;
setTimeout("if(!v)popCategory.style.display='none';",100);
}
</script>
<script type='text/javascript'>
var category=$('J_category'),popCategory=$('J_popCategory');
var cateLi=category.getElementsByTagName('li'),subItems=getElementsByClassName('sub-item','div');
var v=true;
category.onmouseover=function(){popCategory.style.display='block';};
category.onmouseout=function(){popclose();};
popCategory.onmouseover=function(){v=true;};
popCategory.onmouseout=function(){popclose();};
for(var i=0; i<cateLi.length; i++){
cateLi[i].index=i;
cateLi[i].onmouseover=function(){
for(var j=0; j<subItems.length; j++){
subItems[j].style.display='none';
}
subItems[this.index].style.display='block';
v=true;
};
}
function popclose(){
v=false;
setTimeout("if(!v)popCategory.style.display='none';",100);
}
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询