简体   繁体   English

在具有负载掩码和固定宽度的溢出隐藏容器中截取下拉菜单

[英]Dropdown cut off in a overflow hidden container with loadmask and fixed width

A fixed width container, with vertical scrollbar (if more items than fit in the viewport) - this means browser sets overflow-x to auto. 一个固定宽度的容器,带有垂直滚动条(如果视口中容纳的项目过多)-这意味着浏览器将overflow-x设置为auto。

Now inside it are cards with form elements. 现在里面是带有表单元素的卡片。 Each card has a loadmask. 每个卡都有一个加载掩码。 Form elements can have a dropdown (date, multiselect etc) - but they are cut off if they do not fit in the sidebar. 表单元素可以具有一个下拉菜单(日期,多重选择等)-但如果它们不适合边栏,则会被剪切掉。

The jsfiddle example shows the problem: Blue area is the potential dropdown list. jsfiddle示例显示了问题:蓝色区域是潜在的下拉列表。 Green is the loadmask. 绿色是加载掩码。

If i remove relative position from the card class, blue menu works as intended - but loadmask is broken. 如果我从卡类中删除相对位置,则蓝色菜单会按预期工作-但加载掩码已损坏。

How can i get both of them to work? 我怎样才能让他们两个都工作?

http://jsfiddle.net/wLnhh0uz/ http://jsfiddle.net/wLnhh0uz/

CSS: CSS:

 .sidebar { width: 280px; height: 400px; overflow-y: auto; overflow-x: hidden; background-color: grey; } .card { width: 240px; min-height: 50px; background-color: white; flex-grow: 1; display: flex; flex-direction: column; position: relative; margin: 10px; } .formitem { height: 60px; } .absoluteformitem { position: absolute; } .absoluteformitem .absoluteitem { position: absolute; width: 400px; height: 100px; background-color: blue; z-index: 100; } .content { flex-grow: 1; padding: 15px; display: flex; flex-direction: column; } .loadmask { height: 100%; width: 100%; position: absolute; background-color: green; opacity: 0.5; z-index: 101; } 
 <div class="sidebar"> <div class="card"> <div class="content"> <div class="formitem"> formitem1 </div> <div class="formitem absoluteformitem"> <div class="absoluteitem"></div> </div> <div class="formitem"> formitem3 </div> <div class="formitem"> formitem4 </div> </div> <div class="loadmask"></div> </div> <div class="card"> <div class="content"> <div class="formitem"> formitem1 </div> <div class="formitem"> formitem2 </div> <div class="formitem"> formitem3 </div> <div class="formitem"> formitem4 </div> </div> <div class="loadmask"></div> </div> </div> 

You can make below changes for loadmask and then remove position for card 您可以对加载掩码进行以下更改,然后移除卡的位置

position: relative;

please check below link 请检查下面的链接

http://jsfiddle.net/wLnhh0uz/42/ http://jsfiddle.net/wLnhh0uz/42/

Hope this will help you! 希望这个能对您有所帮助!

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

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