简体   繁体   English

jquery 自动完成下拉菜单是透明的

[英]jquery autocomplete dropdown is transparent

I am trying to use jquery autocomplete on one of my textfields, and everything seems to be ok except for the fact that the dropdown is transparent for some reason.我正在尝试在我的一个文本字段上使用 jquery 自动完成功能,除了下拉菜单由于某种原因是透明的这一事实外,一切似乎都正常。

I am linking both jquery-ui.js and jquery-ui.css, both are version 1.11.4.我正在链接 jquery-ui.js 和 jquery-ui.css,两者都是 1.11.4 版。 It seems to be loading the values ok, the transparency of the dropdown seems to be the only problem.它似乎正在加载值,下拉列表的透明度似乎是唯一的问题。 My js code is as simple as it can get:我的 js 代码非常简单:

$( "#edit_account" ).autocomplete({
source: dataArray
});

here is a screenshot of what it looks like:这是它的外观截图:

在此处输入图片说明

I have looked around and have not found the same issue.我环顾四周,没有发现同样的问题。

Thank you.谢谢你。

The issue with the above case was just the transparent background.上述案例的问题只是透明背景。

The list that is appended to the DOM is附加到 DOM 的列表是

<ul class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui-autocomplete-custom"></ul>

with the CSS使用 CSS

.ui-autocomplete-custom {
    background: #87ceeb;
    z-index: 2;
}

This would add a color to the list, and z-index would ensure the element lies above another element.这将为列表添加颜色,z-index 将确保该元素位于另一个元素之上。

.ui-autocomplete { background-color: inherit; }

这个对我有用。

I found this as I had an issue but it was specifically on an IOS mobile device我发现这个是因为我遇到了问题,但它特别是在 IOS 移动设备上

Whilst none of the above worked the following (a hybrid of the above did)虽然以上没有一个工作以下(以上的混合)

I think this will be useful should the above not work.我认为如果上述方法不起作用,这将很有用。

.ui-autocomplete {
    background-color: #fff;
}

I was using animate.css while dynamically adding Input Fields and initializing Twitter Typeahead on the same.我正在使用 animate.css,同时动态添加输入字段并在同一个上初始化 Twitter Typeahead。 Also tried Jquery Autocomplete but no luck, the dropdowns showed weird behaviour and were always transparent.还尝试了 Jquery 自动完成但没有运气,下拉菜单显示出奇怪的行为并且总是透明的。 Removing the Animate.css class did the trick for me.删除 Animate.css 类对我有用。

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

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