我想在我的rails项目中手动使用twitter bootstrap 但是我有这个错误,并且bootstrap的某些功能不起作用。
如果你帮助我,我很感激。谢谢。
控制台上的错误
Uncaught TypeError:无法读取undefined bootstrap-popover.js的属性'Constructor':38
(匿名函数)bootstrap-popover.js:38
(匿名函数)bootstrap-popover.js:115
应用/视图/应用/ index.html.erb
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<%= stylesheet_link_tag "bootstrap" %>
<%= stylesheet_link_tag "bootstrap-responsive" %>
<%= javascript_include_tag "jquery" %>
<%= javascript_include_tag "bootstrap" %>
<%= javascript_include_tag "bootstrap-transition" %>
<%= javascript_include_tag "bootstrap-alert" %>
<%= javascript_include_tag "bootstrap-modal" %>
<%= javascript_include_tag "bootstrap-dropdown" %>
<%= javascript_include_tag "bootstrap-scrollspy" %>
<%= javascript_include_tag "bootstrap-tab" %>
<%= javascript_include_tag "bootstrap-tooltip" %>
<%= javascript_include_tag "bootstrap-popover" %>
<%= javascript_include_tag "bootstrap-button" %>
<%= javascript_include_tag "bootstrap-collapse" %>
<%= javascript_include_tag "bootstrap-carousel" %>
<%= javascript_include_tag "bootstrap-typeahead" %>
<!-- as example, which doesn't work, somehow -->
<i class="icon-search icon-home"></i>
我相信所有必需的js和css文件都在
中答案 0 :(得分:2)
如果您想在Rails&gt; 3中添加资产文件(如.js
,.css
或图片),则应使用清单文件:application.js,application.css。在您的目录中复制源代码后,您应该进行如下声明:
application.js :
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require bootstrap-responcive
//= require tree .
并在application.css中:
*= require_self
*= require bootstrap
*= require_tree .
它无用,包括`&lt;%= javascript_include_tag%&gt;在你的意见。