I am trying to create a hover-tooltip using Bootstrap UI. The tooltip should be visible when mouse is hovered on the button, the tooltip has a link which should be clickable. But the default popover and tooltip provided by Bootstrap UI, disappear when mouse comes out of it. I have searched a lot online, but couldn't find a solution. Some sites have given a solution using jQuery, but my requirement is in AngularJS. Many sites cite that we have to use $tooltipProvider, could you please tell me how to write a customEvent for 'mouseenter' and 'mouseleave' inside the controller.
Asked
Active
Viewed 8,340 times
4
-
http://stackoverflow.com/questions/13015432/how-to-make-bootstrap-tooltip-to-remain-visible-till-the-link-is-clicked – nikhil mehta Jun 03 '15 at 10:32
-
1That one doesn't use the angular tooltip – devqon Jun 03 '15 at 10:33
3 Answers
1
Are you looking for popover tooltip which is being stable and hide once it is accessed...Please see below working fiddle:
<i class="fa fa-info-circle infoIcon" data-toggle="popover" data-content='Lorem Ipsum<br/><a href="#"><span class="learnMore">Learn More</span></a>'></i>
JS:
<i class="fa fa-info-circle infoIcon" data-toggle="popover" data-content='Lorem Ipsum<br/><a href="#"><span class="learnMore">Learn More</span></a>'></i>

Ritesh Kashyap
- 364
- 1
- 16
-
The popover should disappear if mouse is not on the text or the popover. The fiddle you've written, the popover doesn't disappear at all. – akashrajkn Jun 03 '15 at 11:03
-
1It satisfies my requirement, but how do you manipulate it inside a controller? – akashrajkn Jun 03 '15 at 11:33
1
check this link,
http://fiddle.jshell.net/WojtekKruszewski/Zf3m7/22/light/
It has been achieved using jQuery, write a directive in AngularJS. You can integrate jQuery plugin in angularJS app, look at this site
https://amitgharat.wordpress.com/2013/02/03/an-approach-to-use-jquery-plugins-with-angularjs/

clearScreen
- 1,002
- 4
- 15
- 31
0
I made a sticky dropdown extension for dropdown. Here's my code:
'use strict';
angular.module('ui.bootstrap.stickyDropdownToggle', []).directive('stickyDropdownToggle', ['$document', '$location', function ($document, $location) {
var openElement = null,
closeMenu = angular.noop;
return {
restrict: 'CA',
link: function (scope, element, attrs) {
scope.$watch('$location.path', function () { closeMenu(); });
element.parent().bind("click", function (event) { if (event) { event.stopPropagation(); } });
element.bind('click', function (event) {
var elementWasOpen = (element === openElement);
event.preventDefault();
event.stopPropagation();
if (!!openElement) {
closeMenu();
}
if (!elementWasOpen && !element.hasClass('disabled') && !element.prop('disabled')) {
element.parent().addClass('open');
openElement = element;
closeMenu = function (event) {
if (event) {
event.preventDefault();
event.stopPropagation();
}
$document.unbind('click', closeMenu);
element.parent().removeClass('open');
closeMenu = angular.noop;
openElement = null;
};
$document.bind('click', closeMenu);
}
});
}
};
} ]);
and to use it:
<button type="button" class="btn sticky-dropdown-toggle" ng-click="focusOnParticularElementInsideThePopup()"
style="font-size: 1em">
<span class="glyphicon glyphicon glyphicon-tags"></span>
</button>

Stu
- 2,426
- 2
- 26
- 42
-
i'm unable to get it working, can you please give me a link to fiddle or plnkr ? – akashrajkn Jun 03 '15 at 11:01