Twitter bootstrap tooltip trigger default is hover.
I can add data-trigger="focus" to cause the tooltip to display on focus, but how I do both hover and focus?
trigger
is a single-value property, so you have to fake either of both methods:
$('.tooltip').tooltip({trigger: 'hover'}).each(function () {
var $this = $(this), data = $this.data('tooltip');
$this.on('focus.tooltip', $.proxy(data.enter, data))
.on('blur.tooltip', $.proxy(data.leave, data));
});
Update: Alternatively, you can use my patch to Twitter Bootstrap to make trigger
a multi-value property and just set it to hover focus
.
have you tried data-trigger="focus hover"
solution by @Adrian does not work on Bootstrap 3. Use following:
$('[rel=tooltip]').tooltip();
$(document).on('hover', '[rel=tooltip]', function () { $(this).tooltip('show'); });
$(document).on('focus', '[rel=tooltip]', function () { $(this).tooltip('show'); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With