Skip to content

Commit 62da90e

Browse files
committed
Fixing IE support
1 parent ff43983 commit 62da90e

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

src/css/angular-tooltips.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
z-index:9;
66
padding:0.4% 1%;
77
opacity:0;
8-
display:none;
8+
visibility:hidden;
99
-webkit-border-radius:3px;
1010
-moz-border-radius:3px;
1111
border-radius:3px;
12+
left:-200%;
1213
top: 0;
1314
}
1415
._720kb-tooltip-title{
@@ -30,7 +31,7 @@
3031
font-size: 14px;
3132
}
3233
._720kb-tooltip._720kb-tooltip-open {
33-
display:initial;
34+
visiblity:'';
3435
opacity: 1;
3536
}
3637
._720kb-tooltip-caret:before {

src/js/angular-tooltips.js

+25-5
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@
106106

107107
$scope.initTooltip = function initTooltip (tooltipSide) {
108108
if (!$scope.isTooltipEmpty()) {
109-
theTooltip.css('display', 'initial');
109+
110+
theTooltip.css('visibility', 'visible');
110111

111112
height = thisElement[0].offsetHeight;
112113
width = thisElement[0].offsetWidth;
@@ -118,7 +119,7 @@
118119
$scope.parseSpeed();
119120
$scope.tooltipPositioning(tooltipSide);
120121
} else {
121-
theTooltip.css('display', 'none');
122+
theTooltip.css('visibility', 'hidden');
122123
}
123124
};
124125

@@ -127,13 +128,32 @@
127128
offsetLeft = $scope.getOffsetLeft(thisElement[0]);
128129
};
129130

130-
$scope.getOffsetTop = function getOffsetTop (elem){
131+
/*$scope.getOffsetTop = function getOffsetTop (elem){
131132
return elem.getBoundingClientRect().top + $window.scrollY;
132133
};
133134
134135
$scope.getOffsetLeft = function getOffsetLeft (elem){
135136
return elem.getBoundingClientRect().left + $window.scrollX;
136-
};
137+
};*/
138+
$scope.getOffsetTop = function getOffsetTop (elem){
139+
var offtop = elem.getBoundingClientRect().top + $window.scrollY;
140+
//IE8 - 11 fix - window.scrollY is undefied, and offtop is NaN.
141+
if(isNaN(offtop)) {
142+
//get the offset on old properties
143+
offtop = elem.getBoundingClientRect().top + $window.pageYOffset;
144+
}
145+
return offtop;
146+
};
147+
148+
$scope.getOffsetLeft = function getOffsetLeft (elem){
149+
var offleft = elem.getBoundingClientRect().left + $window.scrollX;
150+
//IE8 - 11 fix - window.scrollX is undefied, and offtop is NaN.
151+
if(isNaN(offleft)) {
152+
//get the offset on old properties
153+
offleft = elem.getBoundingClientRect().left + $window.pageXOffset;
154+
}
155+
return offleft;
156+
};
137157

138158
function onMouseEnterAndMouseOver() {
139159
if (!lazyMode || !initialized) {
@@ -196,7 +216,7 @@
196216
};
197217

198218
$scope.hideTooltip = function hideTooltip () {
199-
theTooltip.css('transition', 'opacity ' + speed + 'ms linear, display 0s linear ' + speed + 'ms');
219+
theTooltip.css('transition', 'opacity ' + speed + 'ms linear, visibility 0s linear ' + speed + 'ms');
200220
theTooltip.removeClass(CSS_PREFIX + 'open');
201221
$scope.clearTriggers();
202222
$scope.bindShowTriggers();

0 commit comments

Comments
 (0)