移到空隙相当于移出dropdown了,此时你并没有移动到dropmenu上dropmenu就消失了,所以导致点击不了导航,可以用onmouseover和onmouseout,加个延时处理
#div1{
height: 100px;
width: 100px;
background: #000000;
position: relative;
}
#div2{
height: 200px;
width: 100px;
background: #00A1D6;
display: none;
position: absolute;
left: 0;
top: 130px;
}
window.οnlοad=function(){
var a=document.getElementById('div1')
var b=document.getElementById('div2')
var x=null
b.οnmοuseοver=a.οnmοuseοver=function(){
b.style.display='block';
clearTimeout(x);
}
b.οnmοuseοut=a.οnmοuseοut=function(){
x=setTimeout(function(){b.style.display='none';
},1000)