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

时间:2014-07-16 08:58:43

标签: jquery css autocomplete hover

如何自定义jquery自动完成组合框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

1 个答案:

答案 0 :(得分:0)

您必须更改.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