Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ tooltip-colse-button="" | String(HTML) | false | Set the tooltip HTML close butt
tooltip-class="" | String() | false | Set the tooltip custom CSS class/classes
tooltip-scroll="" | String(Boolean) | false | Set the tooltip to follow the element on scroll/move
tooltip-parent="" | String('#id') | '<body>' | Set the tooltip DOM parent by ID

tooltip-hide="" | String(Boolean) | false | Hide the tooltip

##Options
Angular tooltips allows you to use some options via `attribute` data
Expand Down
39 changes: 25 additions & 14 deletions src/js/angular-tooltips.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
, 'delay': 0
, 'lazy': true
, 'closeButton': null
, 'hide': false

};

this.options = function optionsAccessor() {
Expand Down Expand Up @@ -79,7 +81,8 @@
, lazyMode = typeof attr.tooltipLazy !== 'undefined' && attr.tooltipLazy !== null ? $scope.$eval(attr.tooltipLazy) : tooltipsConfig.lazy
, closeButtonContent = attr.tooltipCloseButton || tooltipsConfig.closeButton
, hasCloseButton = typeof closeButtonContent !== 'undefined' && closeButtonContent !== null
, htmlTemplate = '<div class="_720kb-tooltip ' + CSS_PREFIX + size + '">';
, htmlTemplate = '<div class="_720kb-tooltip ' + CSS_PREFIX + size + '">'
, hide = typeof attr.tooltipHide !== 'undefined' && attr.tooltipHide !== null ? $scope.$eval(attr.tooltipHide) : tooltipsConfig.hide;

if (hideTarget !== 'element' && hideTarget !== 'tooltip') {

Expand All @@ -106,6 +109,7 @@
$scope.title = title;
$scope.content = content;
$scope.html = html;
$scope.hide=hide;

$scope.getHtml = function(){
return $sce.trustAsHtml($scope.html);
Expand Down Expand Up @@ -147,7 +151,7 @@
};

$scope.initTooltip = function initTooltip(tooltipSide) {
if (!$scope.isTooltipEmpty()) {
if ((!$scope.isTooltipEmpty())&&(!$scope.hide)) {

theTooltip.css('visibility', 'visible');

Expand Down Expand Up @@ -193,16 +197,18 @@
};

function onMouseEnterAndMouseOver() {
if (!lazyMode || !initialized) {
if (!$scope.hide) {
if (!lazyMode || !initialized) {

initialized = true;
$scope.initTooltip(side);
}
if (tryPosition) {
initialized = true;
$scope.initTooltip(side);
}
if (tryPosition) {

$scope.tooltipTryPosition();
$scope.tooltipTryPosition();
}
$scope.showTooltip();
}
$scope.showTooltip();
}

function onMouseLeaveAndMouseOut() {
Expand Down Expand Up @@ -410,37 +416,42 @@
theTooltip.remove();
});

if (attr.tooltipTitle) {
if (attr.hasOwnProperty('tooltipTitle')) {

attr.$observe('tooltipTitle', function observeTooltipTitle(val) {
$scope.title = val;
$scope.initTooltip(side);
});
}

if (attr.title) {
if (attr.hasOwnProperty('title')) {

attr.$observe('title', function observeElementTitle(val) {
$scope.title = val;
$scope.initTooltip(side);
});
}

if (attr.tooltipContent) {
if (attr.hasOwnProperty('tooltipContent')) {

attr.$observe('tooltipContent', function observeTooltipContent(val) {
$scope.content = val;
$scope.initTooltip(side);
});
}

if (attr.tooltipHtml) {

if (attr.hasOwnProperty('tooltipHtml')) {
attr.$observe('tooltipHtml', function observeTooltipHtml(val) {
$scope.html = val;
$scope.initTooltip(side);
});
}

if (attr.hasOwnProperty('tooltipHide')) {
attr.$observe('tooltipHide', function observeTooltipHide(val) {
$scope.hide = val === 'false' || val === '' || val ===undefined ;
});
}
}
};
}]);
Expand Down