Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit c49d088

Browse files
authored
Merge pull request #203 from zhangoose/show-tooltip
[New Attribute] tooltip-show-tooltip
2 parents ee60043 + ee960c1 commit c49d088

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ tooltip-size="" | String('large', 'small') | 'medium' | Set your tooltip dimensi
9797
tooltip-speed="" | String('fast', 'slow', 'medium') | 'medium' | Set your tooltip show & hide transition speed
9898
tooltip-hidden="" | String(Boolean) | false | Hide (at all) the tooltip
9999
tooltip-append-to-body="" | String(Boolean) | false | This attribute clones the tooltip and append this directly on body. This enables the tooltip position also, for instance, if you have an scrolling area. **This option does heavy javascript calculation.**
100+
tooltip-show="" | String(Boolean) | false | Show/Hide the tooltip "manually"
100101

101102

102103
## Globals

lib/angular-tooltips.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@
111111
element.removeAttr('tooltip-class');
112112
}
113113

114+
if (element.attr('tooltip-show') !== undefined) {
115+
116+
attributesToAdd['tooltip-show'] = element.attr('tooltip-show');
117+
element.removeAttr('tooltip-show');
118+
}
119+
114120
if (element.attr('tooltip-close-button') !== undefined) {
115121

116122
attributesToAdd['tooltip-close-button'] = element.attr('tooltip-close-button');
@@ -209,7 +215,8 @@
209215
'closeButton': false,
210216
'size': '',
211217
'speed': 'steady',
212-
'tooltipTemplateUrlCache': false
218+
'tooltipTemplateUrlCache': false,
219+
'show': null
213220
};
214221

215222
return {
@@ -263,6 +270,7 @@
263270
$attrs.tooltipSide = $attrs.tooltipSide || tooltipsConf.side;
264271
$attrs.tooltipShowTrigger = $attrs.tooltipShowTrigger || tooltipsConf.showTrigger;
265272
$attrs.tooltipHideTrigger = $attrs.tooltipHideTrigger || tooltipsConf.hideTrigger;
273+
$attrs.tooltipShow = $attrs.tooltipShow || tooltipsConf.show;
266274
$attrs.tooltipClass = $attrs.tooltipClass || tooltipsConf.class;
267275
$attrs.tooltipSmart = $attrs.tooltipSmart === 'true' || tooltipsConf.smart;
268276
$attrs.tooltipCloseButton = $attrs.tooltipCloseButton || tooltipsConf.closeButton.toString();
@@ -650,6 +658,15 @@
650658
oldTooltipHideTrigger = newValue;
651659
}
652660
}
661+
, onTooltipShowTooltip = function onTooltipShowTooltip(newValue) {
662+
663+
if (newValue === 'true') {
664+
665+
tooltipElement.addClass('active');
666+
} else {
667+
tooltipElement.removeClass('active');
668+
}
669+
}
653670
, onTooltipClassChange = function onTooltipClassChange(newValue) {
654671

655672
if (newValue) {
@@ -738,6 +755,7 @@
738755
, unregisterOnTooltipSideChangeObserver = $attrs.$observe('tooltipSide', onTooltipSideChange)
739756
, unregisterOnTooltipShowTrigger = $attrs.$observe('tooltipShowTrigger', onTooltipShowTrigger)
740757
, unregisterOnTooltipHideTrigger = $attrs.$observe('tooltipHideTrigger', onTooltipHideTrigger)
758+
, unregisterOnTooltipShowTooltip = $attrs.$observe('tooltipShow', onTooltipShowTooltip)
741759
, unregisterOnTooltipClassChange = $attrs.$observe('tooltipClass', onTooltipClassChange)
742760
, unregisterOnTooltipSmartChange = $attrs.$observe('tooltipSmart', onTooltipSmartChange)
743761
, unregisterOnTooltipCloseButtonChange = $attrs.$observe('tooltipCloseButton', onTooltipCloseButtonChange)
@@ -796,6 +814,7 @@
796814
unregisterOnTooltipSideChangeObserver();
797815
unregisterOnTooltipShowTrigger();
798816
unregisterOnTooltipHideTrigger();
817+
unregisterOnTooltipShowTooltip();
799818
unregisterOnTooltipClassChange();
800819
unregisterOnTooltipSmartChange();
801820
unregisterOnTooltipCloseButtonChange();

0 commit comments

Comments
 (0)