简体   繁体   English

我如何通过溢出自动获取此子元素以显示父元素何时被隐藏?

[英]How do I get this child element with overflow auto to show when the parent is overflow hidden?

Fiddle here 在这里摆弄

As you can see I'm trying to create a full screen overlay navigation. 如您所见,我正在尝试创建全屏覆盖导航。 I have set the body height to 200%, and when the overlay nav shows I set the body to overflow: hidden; 我将主体高度设置为200%,并且当覆盖导航显示时,我将主体设置为overflow: hidden; .

I've also set the important overlay navigation properties to: 我还将重要的叠加层导航属性设置为:

.flexbar .overlay-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    height: 150%;
    overflow: auto;
}

I set the height 150% for test purposes on the off-chance that there are more menu items than the screen can show on smaller screens. 我出于测试目的将高度设置为150%,以免出现菜单项多于在小屏幕上无法显示的菜单项的情况。 I want the user to be able to scroll within the overlay navigation, but for some reason my overflow: auto; 我希望用户能够在覆盖导航中滚动,但是由于某种原因我的overflow: auto; isn't working? 不工作吗

I think in the long run, messing with height (150%, 200%) is going to affect your layout. 从长远来看,我认为弄乱高度(150%,200%)会影响您的布局。 I forked your JSFiddle, and changed the heights back to 100%. 我分叉了您的JSFiddle,并将高度重新设置为100%。 I also used overflow-x: scroll , which I think should solve your issue if I am understanding your question correctly. 我还使用了overflow-x: scroll ,如果我正确理解了您的问题,我认为应该可以解决您的问题。

Fiddle: https://jsfiddle.net/52gsf85c/ 小提琴: https : //jsfiddle.net/52gsf85c/

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

相关问题 我如何确定何时发生溢出:隐藏的父母的孩子 - How do I determine when a child of an overflow:hidden parent is overflown 当父级溢出为自动时,如何获取位置:绝对子级以溢出父级尺寸? - How to get position:absolute child to overflow the parent dimensions when parent overflow is auto? 如何在溢出的隐藏父元素中显示绝对元素 - How to show absolute element inside the overflow hidden parent element 如何显示被其父对象的溢出遮盖的子元素:隐藏样式设置 - How to show a child element which is obscured by its parent's overflow:hidden style setting 如何在溢出之外显示子 div 内容:隐藏的父级? - How to show child div content outside of overflow: hidden parent? 当孩子被固定时,溢出隐藏在粘性父母身上 - Overflow hidden on sticky parent when child is fixed 如何在父元素外显示下拉菜单并溢出:CSS 中的自动? - How to show a dropdown menu outside a parent element with overflow: auto in CSS? 覆盖父溢出:隐藏,子溢出:可见 - override parent overflow:hidden with child overflow:visible 如何将绝对定位的图像放置在其父元素已隐藏溢出的外部? - how do I place an absolutely positioned image outside its parent element which has overflow hidden? 孩子隐藏在父母之外,显示:inline-blox 和溢出:自动 - Child hidden outside parent with display:inline-blox and overflow: auto
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM