代码之家  ›  专栏  ›  技术社区  ›  Robby

Div在IE中悬停时消失

  •  -1
  • Robby  · 技术社区  · 6 年前

    我不知道这里发生了什么。在Firefox和Chrome中,这是正常工作的,但在IE中不是这样的。我有一个固定的div(firstdiv),在悬停时显示另一个div(hiddendiv)。只要有一个div被悬停在上面,这个div就应该保持可见。然而,在IE中,当你将鼠标悬停在它上面时,它就消失了。为什么会这样?

    我试过尝试不同的z索引值和定位,但我不明白为什么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>
    2 回复  |  直到 6 年前
        1
  •  0
  •   sujithuix    6 年前

    当我办理登机手续时,一切正常。

    不管怎样,下面的代码可能会帮助你。

    .firstdiv:hover + .hiddendiv:hover {
    display: block;
    cursor: pointer;
    }
    
        2
  •  0
  •   Robby    6 年前