twitter-bootstrap – Typeahead.js v0.10.1和Bootstrap 3

前端之家收集整理的这篇文章主要介绍了twitter-bootstrap – Typeahead.js v0.10.1和Bootstrap 3前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚刚更新到最新版本的 typeahead.js以获得一些新功能.它与 @L_404_1@不兼容.使用之前的版本(pre Bloodhound.js),我不得不添加我在论坛中找到的自定义CSS,使其兼容.这个CSS不适用于最新的更新.

有谁知道我可以在哪里获得CSS for bootstrap 3 / typeahead.js v0.10.1?

jsfiddle here

<Satisfy-StackOverflow-Code-Requirement-For-Links-to-jsfiddle>

解决方法

好吧,我设法使用以下css
.twitter-typeahead {
     width: 100%;
     position: relative;
 }

.tt-dropdown-menu {
    width: 100%;
    min-width: 160px;
    margin-top: 2px;
    padding: 5px 0;
    background-color: #fff;
    border: 1px solid #ccc;
    border: 1px solid rgba(0,0.2);
    *border-right-width: 2px;
    *border-bottom-width: 2px;
    -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    border-radius: 6px;
    -webkit-Box-shadow: 0 5px 10px rgba(0,0.2);
    -moz-Box-shadow: 0 5px 10px rgba(0,0.2);
    Box-shadow: 0 5px 10px rgba(0,0.2);
    -webkit-background-clip: padding-Box;
    -moz-background-clip: padding;
    background-clip: padding-Box;
}
.tt-suggestion {
    display: block;
    padding: 3px 20px;
}
.twitter-typeahead .tt-suggestion.tt-cursor {
    color: #fff;
    background-color: #0081c2;
    background-image: -moz-linear-gradient(top,#0088cc,#0077b3);
    background-image: -webkit-gradient(linear,0 0,0 100%,from(#0088cc),to(#0077b3));
    background-image: -webkit-linear-gradient(top,#0077b3);
    background-image: -o-linear-gradient(top,#0077b3);
    background-image: linear-gradient(to bottom,#0077b3);
    background-repeat: repeat-x;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0);
}
.tt-suggestion.tt-cursor a {
    color: #fff;
}
.tt-suggestion p {
    margin: 0;
}

更新typeahead.js v0.11.1

/**********************************************************
 *     typeahead.js v0.11.1 - twitter bootstrap v3.3.5    *
 **********************************************************/

/*root typeahead class*/
.twitter-typeahead {
    display: inherit !important;
    width: 100%;
}

.twitter-typeahead .tt-input[disabled] {
  background-color : #eeeeee !important;
}

/*Added to input that's initialized into a typeahead*/
.twitter-typeahead .tt-input {

}

/*Added to hint input.*/
.twitter-typeahead .hint {

}

/*Added to menu element*/
.twitter-typeahead .tt-menu {
  width: 100%;
  max-height: 500px;
  overflow-y: scroll;
  border: 1px solid #cccccc;

  -moz-Box-shadow: 12px 14px 30px -7px #616161;
  -webkit-Box-shadow: 12px 14px 30px -7px #616161;
  Box-shadow: 12px 14px 30px -7px #616161;
}

/*Added to dataset elements*/
.twitter-typeahead .tt-dataset {

}

/*dded to suggestion elements*/
.twitter-typeahead .tt-suggestion {
  padding: 3px 20px;
  white-space: nowrap;
}

/*Added to menu element when it contains no content*/
.twitter-typeahead .tt-empty {
  background-color: white;
}

/*Added to menu element when it is opened*/
.twitter-typeahead .tt-open {
  background-color: white;
}

/*Added to suggestion element when menu cursor moves to said suggestion*/
.twitter-typeahead .tt-suggestion:hover,.twitter-typeahead .tt-suggestion:focus,.twitter-typeahead .tt-cursor {
  cursor: hand !important;
  background-color: #337ab7;
  color: white;
}

/*Added to the element that wraps highlighted text*/
.twitter-typeahead .tt-highlight {

}
原文链接:https://www.f2er.com/bootstrap/233897.html

猜你在找的Bootstrap相关文章