在 jQuery 对话框中显示自动建议框时出现问题.无论如何,自动建议列表都会显示在对话框下方.我尝试将 autosuggest 的 z-index 属性设置为 > 1004.但没有运气.
I have a problem displaying the autosuggest box inside a jQuery dialog. The auto suggest list is displayed under the dialog no matter what. I have tried setting up the z-index property of autosuggest to > 1004. But no luck.
下面是截图.
这是我用来设置自动建议列表样式的 CSS 类:
This is the CSS class I have used to style the autosuggest list:
ul.as-list {
position: absolute;
list-style-type: none;
margin: 2px 0 0 0;
padding: 0;
font-size: 14px;
color: #000;
font-family: "Lucida Grande", arial, sans-serif;
background-color: #fff;
background-color: rgba(255,255,255,0.95);
box-shadow: 0 2px 12px #222;
-webkit-box-shadow: 0 2px 12px #222;
-moz-box-shadow: 0 2px 12px #222;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
z-index:6000;
}
li.as-result-item, li.as-message {
margin: 0 0 0 0;
padding: 5px 12px;
background-color: transparent;
border: 1px solid #fff;
border-bottom: 1px solid #ddd;
cursor: pointer;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
z-index:6000;
}
我已经在 jsfiddle 页面上传了完整的代码.你可以清楚地看到那里的问题.我该如何解决?
I have uploaded the complete code in this jsfiddle page. You can see the problem there clearly. How can I fix it?
根本原因是最外面的两个元素有overflow: hidden.
The root cause is that the outermost two elements have overflow: hidden.
解决这个问题的最简单方法是:
The simplest way to fix that is:
.ui-dialog, .ui-dialog-content {
overflow: visible !important
}
如果你对使用 !important 不满意(这不是好的做法),你可以找到 overflow: hidden 实际应用的地方,并修复它在那里.
If you're not happy with using !important (it's not good practise), you can find the place where overflow: hidden is actually being applied, and fix it there.
快速修复版本:http://jsfiddle.net/mNQVr/(在 Chrome、Firefox、IE 中测试过)
这篇关于jQuery 对话框中的 Z-index.自动建议列表未正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在 Angular 2/Typescript 中使用 IScrollUse IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
Anime.js 在 Ionic 3 项目中不起作用anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 项目中不起作用)
Ionic 3 - 使用异步数据更新 ObservableIonic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用异步数据更新 Observable)
Angular 2:在本地 .json 文件中找不到文件Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
在 Ionic 2 中,如何创建使用 Ionic 组件的自定义指In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何创建使用 Ionic 组件的自定义指令?)
将 ViewChild 用于动态元素 - Angular 2 &离子2Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(将 ViewChild 用于动态元素 - Angular 2 amp;离子2)