当对象高于另一个元素时,我似乎遇到了 onmouseout 不触发的问题。在我的示例中,向右顶部或底部移动会立即触发 mouseout 事件,但向左移动不会触发。
<html>
<head>
<script type="text/javascript">
var viewedCont;
function view_img(){
viewedCont = document.getElementById('view-container');
viewedCont.style.display='block';
}
function view_img_stop(){
viewedCont.style.display='none';
}
</script>
<style>
$css_inPage
#roll{
z-index:100;
background-color:#0000CC;
height:400px;
width:200px;
}
#view-container{
display:none;
width:355px;
height:402px;
z-index:9999;
position:absolute;
overflow:hidden;
background-color:#CCCCCC;
margin-left:230px;
margin-bottom:90px;
}
</style>
</head>
<body>
<div id="view-container" onmouseout="view_img_stop()">
</div>
<div style="margin-left:200px">
<div id="roll" onmouseover="view_img();"></div>
</div>
</body>
</html>