加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-18 00:23:50 所属栏目:安全 来源:网络整理
导读:我刚刚更新到最新版本的 typeahead.js以获得一些新功能.它与 Bootstrap 3不兼容.使用之前的版本(pre Bloodhound.js),我不得不添加我在论坛中找到的自定义CSS,使其兼容.这个CSS不适用于最新的更新. 有谁知道我可以在哪里获得CSS for bootstrap 3 / typeahead.
我刚刚更新到最新版本的 typeahead.js以获得一些新功能.它与 Bootstrap 3不兼容.使用之前的版本(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 {

}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读