选择Bootstrap模态下的下拉菜单隐藏在模态页脚后面

编程入门 行业动态 更新时间:2024-10-25 15:36:56
本文介绍了选择Bootstrap模态下的下拉菜单隐藏在模态页脚后面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用基于twitter bootstrap示例的模态。我有一个select元素使用selected。当所选择的选择下拉时,它被模态页脚切断。我试图在选择的元素上添加z-index值,但没有什么工作。我在倾斜看它,并想知道是否只是因为select元素是与模态页脚div之前的divs?我使用的默认CSS从选择和引导为好,所以我没有修改任何东西。

I am using a modal based on the example from twitter bootstrap. I have a select element that uses chosen. When the chosen select drops down, it is cut off by the modal footer. I tried to add the z-index value on the chosen elements, but nothing works. I'm looking at it in tilt, and wonder if it is just because the select element is with divs that are before the modal footer div? I'm using the default CSS from chosen and bootstrap for this as well, so I haven't modified anything.

示例。

example.

HTML :

<div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> ×</button> <h3> Add Tag</h3> </div> <div class="modal-body"> <div class="control-group"> <label for="addedTags"> Add tags (separated by commas) </label> <input id="addedTags" style="width: inherit" type="text"> </div> <div class="control-group"> <label for="deleteTags"> Delete tags </label> <select style="display: none;" class="tags chzn-done" id="deleteTags" multiple="multiple" name="deleteTags"><option value="49">Accessories</option> <option value="69">AG_Adriano_Goldschmied</option> <option value="37">BCBG</option> <option value="38">Bebe</option> <option value="45">Bernie_Dexter</option> <option value="19">Black</option> <option value="6">Blue</option> <option value="66">Body-Con</option> <option value="71">Casual</option> <option value="39">Christian_Louboutin</option> <option value="64">Clear</option> <option value="50">Coach</option> </select><div style="width: [object Object]px;" class="chzn-container chzn-container-multi chzn-container-active" id="deleteTags_chzn"> <ul class="chzn-choices"><li class="search-field"><input value="Select Some Options" class="default" autocomplete="off" style="width: 149px;" type="text"></li></ul> <div class="chzn-drop" style="left: 0px; top: 29px;"><ul class="chzn-results"><li id="deleteTags_chzn_o_0" class="active-result highlighted" style="">Accessories</li><li id="deleteTags_chzn_o_1" class="active-result" style="">AG_Adriano_Goldschmied</li><li id="deleteTags_chzn_o_2" class="active-result" style="">BCBG</li><li id="deleteTags_chzn_o_3" class="active-result" style="">Bebe</li><li id="deleteTags_chzn_o_4" class="active-result" style="">Bernie_Dexter</li><li id="deleteTags_chzn_o_5" class="active-result" style="">Black</li><li id="deleteTags_chzn_o_6" class="active-result" style="">Blue</li><li id="deleteTags_chzn_o_7" class="active-result" style="">Body-Con</li><li id="deleteTags_chzn_o_8" class="active-result" style="">Casual</li><li id="deleteTags_chzn_o_9" class="active-result" style="">Christian_Louboutin</li><li id="deleteTags_chzn_o_10" class="active-result" style="">Clear</li><li id="deleteTags_chzn_o_11" class="active-result" style="">Coach</li></ul></div></div> </div> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true"> Close</button> <input class="btn btn-primary" id="btnAddTags" value="Save" type="button"> <span class="loader"></span> </div> <div class="alert alert-error hide"> <button type="button" class="close" data-dismiss="alert"> ×</button> <strong>Error</strong> <span class="alert-msg"></span> </div> <div class="alert alert-success hide"> <button type="button" class="close" data-dismiss="alert"> ×</button> <strong>Success</strong> <span class="alert-msg"></span> </div>

推荐答案

设置位置=相对,绝对或固定。还把z-index类似5000可能有帮助。 (模式是在2000年的az索引。

For z-index to work, you also have to set position = relative, absolute, or fixed. Also putting z-index something like 5000 might help. (the modal is at a z index in the 2000's.

所以在你的css我会添加:

so in your css i would add this:

.class-of-dropdown { position: relative; z-index: 5000; }

编辑: .modal-body 您可能需要将其更改为:

.modal-body class has a overflow-y: auto property. You might need to change this to:

.modal-body { overflow-y:visible; }

更多推荐

选择Bootstrap模态下的下拉菜单隐藏在模态页脚后面

本文发布于:2023-11-23 04:35:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1620114.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模态   菜单   Bootstrap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!