【发布时间】:2017-10-05 14:12:09
【问题描述】:
我在实现 typeahead.js 时遇到了一些问题
当前设置:
- 我使用 Bootstrap v.3.3.7
- 我实现了 jQuery 3.2
- 我从 Github 下载了
typeahead.bundle.min.jsv.0.11.1 - 我将 JS 文件添加到我的项目中并将其链接到
- 我按照他们的文档here 中的描述实现了预先输入的内容
- 我添加了一个名为
.typeahead的(一个空的 CSS)类来初始化 JS 的东西
注意:所有预先输入的东西(实时搜索)都很好用,但是预先输入会破坏我的 css。
-
我的工作 Pug/Jade 搜索栏:
.flipkart-navbar-search.smallsearch.col-xs-12.qSearchBar(style="margin-left:30px;margin-top:15px;")
.row
input.flipkart-navbar-input.col-xs-11(type='text' id="searchInput" placeholder='Übungen suchen...' autofocus)
button.flipkart-navbar-button.col-xs-1
svg(width='15px' height='15px' fill="white")
path(d='.....')
结果:
-
代码,当我添加 .typeahead 类让它初始化 typeahead 时(也给了它一些随机的其他名称,类名不相关):
.flipkart-navbar-search.smallsearch.col-xs-12.qSearchBar(style="margin-left:30px;margin-top:15px;")
.row
input.flipkart-navbar-input.col-xs-11(type='text' id="searchInput" placeholder='Übungen suchen...' autofocus).typeahead
button.flipkart-navbar-button.col-xs-1
svg(width='15px' height='15px' fill="white")
path(d='.....')
结果:
-
这是为什么呢?我的意思是当然 typeahead 会带来它自己的类,比如 tt-hint e.g.显示结果 - 但这些都不是问题。为什么 typeahead 实际上让我的搜索栏看起来像这样。
【问题讨论】:
标签: html twitter-bootstrap pug typeahead.js bootstrap-typeahead