我与使用 JQuery 的 .animation 的方式发生冲突。
我有一个包含 showthis() 和 hidethis() 函数的图像:
function hidethis() {
$('#info1').animate({
bottom: '-150px',
}, 100);
}
function showthis() {
$('#info1').animate({
bottom: '0px',
}, 500);
}
我拥有的元素是放置在页面上的图像和 div 位置:固定;在图像上作为显示/隐藏信息选项卡。
以下是每个元素的样式:
.slide img {
position: absolute;
top: 0px;
left: 0px;
}
.info {
position: fixed;
bottom: -150px;
left: 0px;
width: 527px;
height: 100px;
background-color: white;
padding: 15px;
opacity:0.9;
}
并且 JQuery 是由图像中的鼠标事件触发的:
onmouseover="javascript:showthis();" onmouseout="javascript:hidethis();"
冲突:
浮动在图像上方的 div(每次访问者将鼠标悬停在图像上时都会显示)与图像上的 onmouseout 冲突。如果将鼠标悬停在图像上,则会显示 div。但是,如果您将鼠标悬停在 div 上同时仍将鼠标悬停在图像上,则 div 会隐藏并且它会“混淆”并开始多次进出,而我仍在将鼠标移动到 div 即将出现的图像上方。我怎样才能防止这种情况发生?