3

我使用 bootstrap v3.0.0 和 typeahead.js 实现了一个搜索栏下拉菜单。在我的项目完成时(2个月前)。我使用以下内容来包含模板引擎和 typeahead.min.js

<link href="http://raw.github.com/jharding/typeahead.js-bootstrap.css/master/typeahead.js-bootstrap.css" rel="stylesheet" media="screen">

<script src="http://twitter.github.com/typeahead.js/releases/latest/typeahead.min.js"></script>

 <script src="http://twitter.github.io/typeahead.js/js/hogan-2.0.0.js"></script>

现在突然间,我受到了“这里没有 GitHub 页面”的欢迎。当我试图访问

http://twitter.github.com/typeahead.js/releases/latest/typeahead.min.js

http://twitter.github.io/typeahead.js/js/hogan-2.0.0.js

我的搜索下拉菜单不再起作用。我试图用一个工作链接替换 ​​hogan 模板链接,https://raw.github.com/twitter/hogan.js/master/web/builds/2.0.0/hogan-2.0.0.js 但这里没有 typeahead.min.js 的替代。事实上,任何版本都没有 typeahead.min.js。现在他们已将其更改为

http://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js 

由于它是升级版,因此不起作用。知道如何找到我正在使用的版本。我真的对正在发生的事情感到困惑,需要你的帮助。谢谢。

4

2 回答 2

2

You should use a CDN for sourcing your Javascript dependencies.

For example if you used cdnjs.com, instead of:

<script src="http://twitter.github.com/typeahead.js/releases/latest/typeahead.min.js">

you would use:

<script src="//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.9.3/typeahead.min.js"></script>
于 2014-02-03T00:05:24.860 回答
0

如果你想确保始终使用最新的 master 分支,Github 打破了 raw.github.com 托管的 javascript 的嵌入。但是,这是一个简单的修复,只需删除“。” 域名使用期限:“rawgithub.com”

原来的:

<link href="http://raw.github.com/jharding/typeahead.js-bootstrap.css/master/typeahead.js-bootstrap.css" rel="stylesheet" media="screen">

变成:

<link href="http://rawgithub.com/jharding/typeahead.js-bootstrap.css/master/typeahead.js-bootstrap.css" rel="stylesheet" media="screen">
于 2014-04-18T20:36:26.723 回答