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