1
我想開始使用Twitter Bootstrap for Rails。 popover()
函數完全不起作用。什麼都沒發生。Twitter Bootstrap.popover()函數不能在Rails中工作
layouts/application.html.erb
:
<!DOCTYPE html>
<html>
<head>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-buttons.js" %>
<%= javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-twipsy.js" %>
<%= javascript_include_tag "http://twitter.github.com/bootstrap/1.4.0/bootstrap-popover.js" %>
<%= csrf_meta_tags %>
<script>
$(function() {
$("a[rel=popover]")
.popover({
offset: 10
})
.click(function(e) {
e.preventDefault()
})
});
</script>
</head>
<body>
<%= yield %>
</body>
</html>
這裏是我的我的views/test/test.htlm.erb
的一部分:
<li>
<a data-placement="below"
class="btn danger span2"
data-content="This is a test"
href="#"
rel="popover">+ Test</a>
</li>
我的Gemfile的部分:
gem 'rails', '3.1.3'
gem 'jruby-openssl'
gem 'json'
group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
gem 'jquery-rails'
end
我也試圖複製/粘貼在我的application.js
文件twipsy.js
和popover.js
,並把它與調用我的佈局/ application.html.erb:
<%= javascript_include_tag "application" %>
我缺少什麼?有任何想法嗎?
是jQuery的還包括您的網頁上? – Pierre 2011-12-29 05:12:09