[英]how to show sub-menu when using the scroll bar on a menu?
Good morning, I have a menu where you need it has a vertical side bar. 早上好,我有一个您需要的菜单,带有垂直的侧边栏。 As you can see in the picture, I could add it. 如您在图片中看到的,我可以添加它。 However, when the mouse pointer hovers over the menu items, submenus appear, but they are hidden by the bar. 但是,当鼠标指针悬停在菜单项上时,会出现子菜单,但它们被栏隐藏。 I would like the sub menus stay overlapped the bar, ie, they appeared in front, not getting hidden. 我希望子菜单与栏保持重叠,即它们出现在前面而不隐藏。 Already tried changing the z-index of the submenu, but it did not work. 已经尝试更改子菜单的z索引,但是没有用。 Anyone know any alternative, or how can I solve this? 有人知道任何替代方法,或者我该如何解决?
then, as the system menu is all dynamically mounted, I created an example in jsFiddle. 然后,由于系统菜单都是动态挂载的,因此我在jsFiddle中创建了一个示例。 The problem is that the menu has sub-menus, and when I try to access them, they are "inside" the box that creates the scrollbar. 问题在于菜单具有子菜单,当我尝试访问它们时,它们位于创建滚动条的框的“内部”。 link: jsfiddle.net/tBJe3/10/ 链接:jsfiddle.net/tBJe3/10/
thank you! 谢谢!
try this one, 试试这个
.menuLateral {
margin-left: 4px;
margin-top: 1%;
position: relative;
width: 35%;
height:200px;
color: #B2C2B9;
float: left;
overflow:visible;
}
In your code you have set position: relative;
在您的代码中,您已设置position: relative;
for almost all containers. 适用于几乎所有容器。 If you remove them, your absolutely positioned
sub-menus will be relative to the document and also will be on top of your scrollable
content. 如果删除它们,则absolutely positioned
子菜单将相对于文档,并且还将位于scrollable
内容的顶部。
Here is the updated version of your code in JSFiddle . 这是JSFiddle中代码的更新版本。
Please note , that by doing in this way, some of your sub-menu
s will not appear where you want. 请注意 ,通过这种方式,某些sub-menu
将不会出现在您想要的位置。 So maybe you need to make with fixed positions or position them manually (and dynamically ) using JavaScript
. 因此,也许您需要固定位置或使用JavaScript
手动 ( 动态 ) JavaScript
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.