简体   繁体   English

在嵌套 div 上方定位快速拨号菜单(材质 UI)

[英]Position Speed dial menu (Material UI) above nested div

Sandbox code: Link沙盒代码: 链接

I have two nested divs , namely , speeddial-div and outer-div .我有两个嵌套的 div ,即speeddial-divouter-div The speed-dial div has a Speed Dial component from Material UI ( find here ) which shows floating icons. speed-dial div 有一个来自 Material UI(在此处找到)的快速拨号组件,它显示浮动图标。 Presently when I hover over the component it overflows and a scrollbar appears , the conventional behavior.目前,当我将鼠标悬停在组件上时,它会溢出并出现滚动条,这是常规行为。 But I want to display this menu upon hover over the red outer-div .但是我想在将鼠标悬停在红色的outer-div上时显示这个菜单。 Presently it looks like this:目前它看起来像这样:

在此处输入图像描述

But I want the print and other icons to overflow on the red div without the need of a scrollbar.但我希望打印和其他图标在红色 div 上溢出,而不需要滚动条。 I tried absolute and relative positioning to no result.我尝试了绝对和相对定位,但没有结果。 Any ideas on how I can achieve the desired behaviour?关于如何实现所需行为的任​​何想法?

You can achieve it by having the second div with className outer-div inside speeddial-div .您可以通过在speeddial-div中使用 className outer-div的第二个 div 来实现。 This will make the speed dial component to overlap on the second div instead of overflowing the div.这将使快速拨号组件在第二个 div 上重叠,而不是溢出 div。

Working link : Sandbox Link工作链接: 沙盒链接

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

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