我正在尝试安装在这里找到的 jschr 的 bootstrap-modal:https://github.com/jschr/bootstrap-modal在我的 Rails 元素中使用。
github页面的说明表明:
- 在主 Bootstrap css 文件之后包含 css/bootstrap-modal.css。
- 在主 Bootstrap js 文件之后包含 js/bootstrap-modalmanager.js 和 js/bootstrap-modal.js。
这是什么意思?我认为 bootstrap 是通过包含在 gemfile 中并运行 bundle update/install 安装在 rails 中的。
最佳答案
如何安装:
Vicente Reig created a Ruby Gem for you to use!
按照他的安装说明将 gem 添加到您的 gemfile,然后安装 gem。这会将您需要的文件添加到您的 gem 目录中。
如何初始化:
您需要添加两个require
语句:
application.js
文件中的第一个:
前几行将用 //
注释掉,这是您添加 .js
调用的地方。
//= require bootstrap-modal
//= require bootstrap-modalmanager
在你的 application.css
文件中做同样的事情:
//= require bootstrap <--(this should already be there.)
//= require bootstrap-modal
如果您的 application.css
文件没有 require bootstrap
行,那么它可能有:
@import "bootstrap";
如果是这样,添加:
@import "bootstrap";
@import "bootstrap-modal";
那样的话,bootstrap-modal 加载第二。
关于javascript - 如何在 Rails 中安装 jschr 的 bootstrap-modal,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25026659/