I am using the tooltip tool in Bootstrap 3.x in my web app to show helpful info. It works in this way:
$('[data-toggle="tooltip"]').tooltip({
'animation': true,
'placement': 'top',
'trigger': 'hover',
'html':true,
'container': 'body'
});
Please note that I have to use hover to trigger the tooltip. Now I need to add a new tooltip and its tooltip text contains a HTML link. A visitor should be able to mouse over the tooltip text to click the link.
The problem is that when a visitor moves his mouse, the tooltip text disappears before he can reach the tooltip text area.
This is using tooltip now. See if this better answer your question.
var originalLeave = $.fn.tooltip.Constructor.prototype.leave;
$.fn.tooltip.Constructor.prototype.leave = function(obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
var container, timeout;
originalLeave.call(this, obj);
if (obj.currentTarget) {
container = $(obj.currentTarget).siblings('.tooltip')
timeout = self.timeout;
container.one('mouseenter', function() {
//We entered the actual popover – call off the dogs
clearTimeout(timeout);
//Let's monitor popover content instead
container.one('mouseleave', function() {
$.fn.tooltip.Constructor.prototype.leave.call(self, self);
});
})
}
};
$('body').tooltip({
selector: '[data-toggle]',
trigger: 'click hover',
placement: 'auto',
delay: {
show: 50,
hide: 400
}
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<p>
<button class='btn btn-primary btn-large' data-toggle="tooltip" data-html="true" title="<a href='http://www.wojt.eu' target='blank' >click me, I'll try not to disappear</a>">hover here</button>
</p>