|
294 | 294 | */
|
295 | 295 | function _previousStep() {
|
296 | 296 | this._direction = 'backward';
|
297 |
| - |
| 297 | + |
298 | 298 | if (this._currentStep === 0) {
|
299 | 299 | return false;
|
300 | 300 | }
|
|
317 | 317 | function _exitIntro(targetElement) {
|
318 | 318 | //remove overlay layer from the page
|
319 | 319 | var overlayLayer = targetElement.querySelector('.introjs-overlay');
|
320 |
| - |
| 320 | + |
321 | 321 | //return if intro already completed or skipped
|
322 | 322 | if (overlayLayer == null) {
|
323 | 323 | return;
|
|
363 | 363 | } else if (document.detachEvent) { //IE
|
364 | 364 | document.detachEvent('onkeydown', this._onKeyDown);
|
365 | 365 | }
|
366 |
| - |
| 366 | + |
367 | 367 | //set the step to zero
|
368 | 368 | this._currentStep = undefined;
|
369 | 369 | }
|
|
378 | 378 | * @param {Object} arrowLayer
|
379 | 379 | */
|
380 | 380 | function _placeTooltip(targetElement, tooltipLayer, arrowLayer, helperNumberLayer) {
|
| 381 | + var tooltipCssClass = '', |
| 382 | + currentStepObj, |
| 383 | + tooltipOffset, |
| 384 | + targetElementOffset; |
| 385 | + |
381 | 386 | //reset the old style
|
382 | 387 | tooltipLayer.style.top = null;
|
383 | 388 | tooltipLayer.style.right = null;
|
|
396 | 401 | //prevent error when `this._currentStep` is undefined
|
397 | 402 | if (!this._introItems[this._currentStep]) return;
|
398 | 403 |
|
399 |
| - var tooltipCssClass = ''; |
400 |
| - |
401 | 404 | //if we have a custom css class for each step
|
402 |
| - var currentStepObj = this._introItems[this._currentStep]; |
| 405 | + currentStepObj = this._introItems[this._currentStep]; |
403 | 406 | if (typeof (currentStepObj.tooltipClass) === 'string') {
|
404 | 407 | tooltipCssClass = currentStepObj.tooltipClass;
|
405 | 408 | } else {
|
|
411 | 414 | //custom css class for tooltip boxes
|
412 | 415 | var tooltipCssClass = this._options.tooltipClass;
|
413 | 416 |
|
414 |
| - var currentTooltipPosition = this._introItems[this._currentStep].position; |
| 417 | + currentTooltipPosition = this._introItems[this._currentStep].position; |
415 | 418 | switch (currentTooltipPosition) {
|
416 | 419 | case 'top':
|
417 | 420 | tooltipLayer.style.left = '15px';
|
|
423 | 426 | arrowLayer.className = 'introjs-arrow left';
|
424 | 427 | break;
|
425 | 428 | case 'left':
|
426 |
| - if (this._options.showStepNumbers == true) { |
| 429 | + if (this._options.showStepNumbers == true) { |
427 | 430 | tooltipLayer.style.top = '15px';
|
428 | 431 | }
|
429 | 432 | tooltipLayer.style.right = (_getOffset(targetElement).width + 20) + 'px';
|
|
433 | 436 | arrowLayer.style.display = 'none';
|
434 | 437 |
|
435 | 438 | //we have to adjust the top and left of layer manually for intro items without element{
|
436 |
| - var tooltipOffset = _getOffset(tooltipLayer); |
| 439 | + tooltipOffset = _getOffset(tooltipLayer); |
437 | 440 |
|
438 | 441 | tooltipLayer.style.left = '50%';
|
439 | 442 | tooltipLayer.style.top = '50%';
|
|
446 | 449 | }
|
447 | 450 |
|
448 | 451 | break;
|
| 452 | + case 'bottom-right-aligned': |
| 453 | + arrowLayer.className = 'introjs-arrow top-right'; |
| 454 | + tooltipLayer.style.right = '0px'; |
| 455 | + tooltipLayer.style.bottom = '-' + (_getOffset(tooltipLayer).height + 10) + 'px'; |
| 456 | + break; |
| 457 | + case 'bottom-middle-aligned': |
| 458 | + targetElementOffset = _getOffset(targetElement); |
| 459 | + tooltipOffset = _getOffset(tooltipLayer); |
| 460 | + |
| 461 | + arrowLayer.className = 'introjs-arrow top-middle'; |
| 462 | + tooltipLayer.style.left = (targetElementOffset.width/2 - tooltipOffset.width/2) + 'px'; |
| 463 | + tooltipLayer.style.bottom = '-' + (tooltipOffset.height + 10) + 'px'; |
| 464 | + break; |
| 465 | + case 'bottom-left-aligned': |
| 466 | + // Bottom-left-aligned is the same as the default bottom |
449 | 467 | case 'bottom':
|
450 | 468 | // Bottom going to follow the default behavior
|
451 | 469 | default:
|
|
467 | 485 | //prevent error when `this._currentStep` in undefined
|
468 | 486 | if (!this._introItems[this._currentStep]) return;
|
469 | 487 |
|
470 |
| - var currentElement = this._introItems[this._currentStep]; |
471 |
| - var elementPosition = _getOffset(currentElement.element); |
| 488 | + var currentElement = this._introItems[this._currentStep], |
| 489 | + elementPosition = _getOffset(currentElement.element), |
| 490 | + widthHeightPadding = 10; |
472 | 491 |
|
473 |
| - var widthHeightPadding = 10; |
474 | 492 | if (currentElement.position == 'floating') {
|
475 | 493 | widthHeightPadding = 0;
|
476 | 494 | }
|
|
712 | 730 | while (parentElm != null) {
|
713 | 731 | if (parentElm.tagName.toLowerCase() === 'body') break;
|
714 | 732 |
|
715 |
| - //fix The Stacking Contenxt problem. |
| 733 | + //fix The Stacking Contenxt problem. |
716 | 734 | //More detail: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context
|
717 | 735 | var zIndex = _getPropValue(parentElm, 'z-index');
|
718 | 736 | var opacity = parseFloat(_getPropValue(parentElm, 'opacity'));
|
719 | 737 | if (/[0-9]+/.test(zIndex) || opacity < 1) {
|
720 | 738 | parentElm.className += ' introjs-fixParent';
|
721 | 739 | }
|
722 |
| - |
| 740 | + |
723 | 741 | parentElm = parentElm.parentNode;
|
724 | 742 | }
|
725 | 743 |
|
|
738 | 756 | window.scrollBy(0, bottom + 100); // 70px + 30px padding from edge to look nice
|
739 | 757 | }
|
740 | 758 | }
|
741 |
| - |
| 759 | + |
742 | 760 | if (typeof (this._introAfterChangeCallback) !== 'undefined') {
|
743 | 761 | this._introAfterChangeCallback.call(this, targetElement.element);
|
744 | 762 | }
|
|
0 commit comments