简体   繁体   English

CSS菜单下拉悬浮问题

[英]CSS Menu Dropdown Hover issue

I'm having an issue with a responsive dropdown navigation list whereby if you move the mouse slowly off of a parent link, the submenu for the last parent item shows instead. 我在响应式下拉导航列表中遇到问题,如果您将鼠标缓慢移离父链接,则会显示最后一个父项的子菜单。

I've uploaded an example at: http://webe.emv3.com/aps/twelve/primary.html 我在以下网址上传了一个示例: http : //webe.emv3.com/aps/twelve/primary.html

If you hover over 'Top Up Card' then move the mouse slowly downwards towards the submenu, help is activated instead. 如果将鼠标悬停在“充值卡”上,然后将鼠标缓慢向下移至子菜单,则会激活帮助。

Do you have any idea why this might be happening? 您知道为什么会这样吗?

It's because .rdd-menu .submenu-panel is not hidden and/or positioned out of the way. 这是因为.rdd-menu .submenu-panel没有隐藏和/或定位。 So when you :hover over the parent all the .submenu-panel 's are still visible. 因此,当您将鼠标悬停在父对象上时,所有.submenu-panel仍可见。 Having a height:0 does not hide an element. height:0不会隐藏元素。

A simple: 一个简单的:

.rdd-menu .submenu-panel {
   display: none;
}    

.rdd-menu li:hover > .submenu-panel {
   display: block;
}

will fix it. 将修复它。 You can disregard your height declarations too. 您也可以忽略身高声明。

edit: I just noticed you had transitions on them. 编辑:我只是注意到您对他们有过渡。 You can just position the submenu's offscreen to keep the transitions intact: 您可以将子菜单置于屏幕外,以保持过渡效果不变:

.rdd-menu .submenu-panel {
   top: -10%;
}    

.rdd-menu li:hover > .submenu-panel {
   top: 100%;
}

I've located the reason. 我找到了原因。 There was an issue with the borders on line 153-156: 第153-156行的边界出现问题:

.rdd-menu .submenu-panel    {
    border-radius:0 0 10px 10px;
    border:1px solid #ccc;
    border-top:0;

Even though the top border had been removed, having the left, right, and bottom borders caused the issue. 即使顶部边框已删除,但左侧,右侧和底部边框仍引起了问题。 Removing them has resolved it. 删除它们已解决。

I appreciate your help with this. 感谢您的帮助。 Thank you. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM