我认为这很简单,但有些问题。我使用的唯一 Bootstrap gem 是简单的形式 one。
我有以下html:
应用程序/视图/用户/new.html.erb
<div id="hint">hint</div>
然后在我的javascript application.js文件中,我有:
//= require jquery
//= require jquery_ujs
//= require bootstrap.min.js
//= require_self
//= require_tree .
//= require_tree ../../../vendor/assets/javascripts/.
$("#hint").popover({
title: 'A title!',
content: 'Some content!'
})
在Twitter Bootstrap Tooltip Instructions中,它说只是把这个:
$('#example').tooltip(options)
但我什么也得不到。我该如何使用它?
回答
我必须这样做才能让它工作:
<div id="hint">
<a href="#" rel="tooltip" title="some content">hint</a>
</div>
jQuery( function($) {
$("#hint a").tooltip()
});