jquery - 自定义 jquery 自动完成组合框 css

标签 jquery css autocomplete hover

如何自定义 jquery autocomplete combobox css 以便我可以让它看起来像图片中那样以更改其悬停样式? enter image description here

我的部分代码是

.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active,
.ui-autocomplete, .ui-autocomplete:hover,
.ui-menu-item, .ui-menu-item:hover,
.ui-menu-item a, .ui-menu-item a:hover,
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus,
.ui-widget-content .ui-state-hover,
.ui-widget-header .ui-state-hover,
.ui-menu .ui-menu-item a.ui-state-focus,
.ui-menu .ui-menu-item a.ui-state-active,
.ui-menu .ui-menu-item a {
    background-color: white;
    text-wrap: none;
    font-weight: normal;
    color: black;
}

.custom-combobox-toggle {
position: absolute;
top: 0;
bottom: 0;
margin-left: -1px;
padding: 0;
/* support: IE7 */
*height: 1.7em;
*top: 0.1em;
width: 40px;
color: white;
border: thin;
border-color: blue;
}

.ui-autocomplete {
    max-height: 200px;
    overflow-y: auto;
    /* prevent horizontal scrollbar */
    overflow-x: hidden;
    /* add padding to account for vertical scrollbar */
    position: absolute;
    font-style: normal;
}

图片:现有外观

enter image description here

最佳答案

您必须更改 .ui-state-focus 的 CSS。 嗯,这对你有用:

.ui-autocomplete .ui-menu-item {
  background:white;
}
.ui-autocomplete .ui-state-focus {
    background:rgb(39, 108, 255); //Change blue color to your favourite shade
    color:white;
}

JSFiddle Demo

关于jquery - 自定义 jquery 自动完成组合框 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24776493/

相关文章:

javascript - 以数组形式检索选择器类的数据属性

html - CSS - 搜索框重叠 div 的填充

javascript - 幻灯片故障 - 调试帮助

javascript 无法显示警报

javascript - 单击时查找并删除样式属性

javascript - 使用 Javascript 将文本居中并使用 css3 viewport 调整大小在调整大小时会很不稳定

css - 在 JavaFX CSS 中设置 BackgroundImage 路径的正确方法

android - 禁用 Android 文本字段建议

java - Swing 自动完成文本字段/下拉

shell - Z shell 中的 cd -1、-2、-3 等