Skip to content

Commit 06300ab

Browse files
committed
isEmptyTooltip, closes #19
1 parent 717889f commit 06300ab

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/js/angular-tooltips.js

+20-9
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,29 @@
6767

6868
body.append(theTooltip);
6969

70+
$scope.isTooltipEmpty = function checkEmptyTooltip () {
71+
72+
if (!title && !content) {
73+
74+
return true;
75+
}
76+
};
77+
7078
$scope.initTooltip = function initTooltip (tooltipSide) {
7179

72-
height = thisElement[0].offsetHeight;
73-
width = thisElement[0].offsetWidth;
74-
offsetTop = $scope.getRootOffsetTop(thisElement[0], 0);
75-
offsetLeft = $scope.getRootOffsetLeft(thisElement[0], 0);
76-
//get tooltip dimension
77-
theTooltipHeight = theTooltip[0].offsetHeight;
78-
theTooltipWidth = theTooltip[0].offsetWidth;
80+
if (!$scope.isTooltipEmpty()) {
81+
82+
height = thisElement[0].offsetHeight;
83+
width = thisElement[0].offsetWidth;
84+
offsetTop = $scope.getRootOffsetTop(thisElement[0], 0);
85+
offsetLeft = $scope.getRootOffsetLeft(thisElement[0], 0);
86+
//get tooltip dimension
87+
theTooltipHeight = theTooltip[0].offsetHeight;
88+
theTooltipWidth = theTooltip[0].offsetWidth;
7989

80-
$scope.parseSpeed();
81-
$scope.tooltipPositioning(tooltipSide);
90+
$scope.parseSpeed();
91+
$scope.tooltipPositioning(tooltipSide);
92+
}
8293
};
8394

8495
$scope.getRootOffsetTop = function getRootOffsetTop (elem, val){

0 commit comments

Comments
 (0)