|
247 | 247 | * @param {Object} arrowLayer
|
248 | 248 | */
|
249 | 249 | function _placeTooltip(targetElement, tooltipLayer, arrowLayer) {
|
250 |
| - var tooltipLayerPosition = _getOffset(tooltipLayer); |
251 | 250 | //reset the old style
|
252 | 251 | tooltipLayer.style.top = null;
|
253 | 252 | tooltipLayer.style.right = null;
|
254 | 253 | tooltipLayer.style.bottom = null;
|
255 | 254 | tooltipLayer.style.left = null;
|
256 | 255 |
|
257 |
| - //prevent error when `this._currentStep` in undefined |
| 256 | + //prevent error when `this._currentStep` is undefined |
258 | 257 | if(!this._introItems[this._currentStep]) return;
|
259 | 258 |
|
260 | 259 | var currentTooltipPosition = this._introItems[this._currentStep].position;
|
261 | 260 | switch (currentTooltipPosition) {
|
262 | 261 | case 'top':
|
263 | 262 | tooltipLayer.style.left = '15px';
|
264 |
| - tooltipLayer.style.top = '-' + (tooltipLayerPosition.height + 10) + 'px'; |
| 263 | + tooltipLayer.style.top = '-' + (_getOffset(tooltipLayer).height + 10) + 'px'; |
265 | 264 | arrowLayer.className = 'introjs-arrow bottom';
|
266 | 265 | break;
|
267 | 266 | case 'right':
|
268 |
| - tooltipLayer.style.right = '-' + (tooltipLayerPosition.width + 10) + 'px'; |
| 267 | + tooltipLayer.style.left = (_getOffset(targetElement).width + 20) + 'px'; |
269 | 268 | arrowLayer.className = 'introjs-arrow left';
|
270 | 269 | break;
|
271 | 270 | case 'left':
|
272 | 271 | tooltipLayer.style.top = '15px';
|
273 |
| - tooltipLayer.style.left = '-' + (tooltipLayerPosition.width + 10) + 'px'; |
| 272 | + tooltipLayer.style.right = (_getOffset(targetElement).width + 20) + 'px'; |
274 | 273 | arrowLayer.className = 'introjs-arrow right';
|
275 | 274 | break;
|
276 | 275 | case 'bottom':
|
277 | 276 | // Bottom going to follow the default behavior
|
278 | 277 | default:
|
279 |
| - tooltipLayer.style.bottom = '-' + (tooltipLayerPosition.height + 10) + 'px'; |
| 278 | + tooltipLayer.style.bottom = '-' + (_getOffset(tooltipLayer).height + 10) + 'px'; |
280 | 279 | arrowLayer.className = 'introjs-arrow top';
|
281 | 280 | break;
|
282 | 281 | }
|
|
0 commit comments