html - Div 在 IE 中悬停时消失
问题描述
我不确定这里发生了什么。在 Firefox 和 Chrome 中,这可以正常工作,但在 IE 中不行。我有一个固定的 div (firstdiv),它在悬停时显示另一个 div (hiddendiv)。只要任一 div 悬停在该 div 上,该 div 就应该保持可见。但是,在 IE 中,当您将鼠标悬停在它上面时它会消失。为什么是这样?
我尝试过使用不同的 z-index 值和定位,但我不明白为什么 IE 不能正确处理这个问题。
.firstdiv {
background: red;
position: fixed;
left: 10px;
bottom: 10px;
height: 50px;
width: 50px;
cursor: pointer;
z-index: 1110;
}
.hiddendiv {
background: blue;
position: fixed;
bottom: 60px;
height: 40px;
width: 244px;
display: none;
cursor: pointer;
z-index: 1200;
}
.firstdiv:hover + .hiddendiv {
display: block;
cursor: pointer;
}
.hiddendiv:hover {
display: block;
cursor: pointer;
}
<div class="firstdiv"></div>
<div class="hiddendiv"></div>
解决方案
当我检查 IE 时,它工作正常。
不确定您使用的是哪个版本。不确定您的实际代码与您在此处提供的示例代码相同。
无论如何,下面的代码可能会对您有所帮助。
.firstdiv:hover + .hiddendiv:hover {
display: block;
cursor: pointer;
}
推荐阅读
- r - 如何将 lapply() 与带参数的函数一起应用
- scala - 将一个案例类别转换为具有相同结构但具有一个附加字段的另一个案例类别
- macos - 带有两个输入的脚本创建对话框
- node.js - Mongoose eachAsync:承诺的执行顺序出乎意料
- node.js - 如何重定向到 ASK-SDK v2 Node.JS 中的不同意图处理程序?
- javascript - javascript 引用数组语法
- google-maps - Google Maps v3 API - 自动平滑缩放到标记
- python - 使用不同大小的数据框创建数据框
- java - 如何在使用 jira-plugin 在 JIRA 中创建问题时填充字段的默认值?
- java - Problem with one command I want to execute through Java in Linux shell