|
103 | 103 | element: currentElement,
|
104 | 104 | intro: currentElement.getAttribute('data-intro'),
|
105 | 105 | step: parseInt(currentElement.getAttribute('data-step'), 10),
|
106 |
| - tooltipClass: currentElement.getAttribute('data-tooltipClass'), |
| 106 | + tooltipClass: currentElement.getAttribute('data-tooltipClass'), |
107 | 107 | position: currentElement.getAttribute('data-position') || this._options.tooltipPosition
|
108 | 108 | };
|
109 | 109 | }
|
|
116 | 116 | var currentElement = allIntroSteps[i];
|
117 | 117 |
|
118 | 118 | if (currentElement.getAttribute('data-step') == null) {
|
119 |
| - |
| 119 | + |
120 | 120 | while (true) {
|
121 | 121 | if (typeof introItems[nextStep] == 'undefined') {
|
122 | 122 | break;
|
|
129 | 129 | element: currentElement,
|
130 | 130 | intro: currentElement.getAttribute('data-intro'),
|
131 | 131 | step: nextStep + 1,
|
132 |
| - tooltipClass: currentElement.getAttribute('data-tooltipClass'), |
| 132 | + tooltipClass: currentElement.getAttribute('data-tooltipClass'), |
133 | 133 | position: currentElement.getAttribute('data-position') || this._options.tooltipPosition
|
134 | 134 | };
|
135 | 135 | }
|
|
141 | 141 | for (var z = 0; z < introItems.length; z++) {
|
142 | 142 | introItems[z] && tempIntroItems.push(introItems[z]); // copy non-empty values to the end of the array
|
143 | 143 | }
|
144 |
| - |
| 144 | + |
145 | 145 | introItems = tempIntroItems;
|
146 | 146 |
|
147 | 147 | //Ok, sort all items with given steps
|
|
418 | 418 | skipTooltipButton = oldHelperLayer.querySelector('.introjs-skipbutton'),
|
419 | 419 | prevTooltipButton = oldHelperLayer.querySelector('.introjs-prevbutton'),
|
420 | 420 | nextTooltipButton = oldHelperLayer.querySelector('.introjs-nextbutton');
|
421 |
| - |
| 421 | + |
422 | 422 | //hide the tooltip
|
423 | 423 | oldtooltipContainer.style.opacity = 0;
|
424 | 424 |
|
|
449 | 449 | oldtooltipLayer.innerHTML = targetElement.intro;
|
450 | 450 | //set the tooltip position
|
451 | 451 | _placeTooltip.call(self, targetElement.element, oldtooltipContainer, oldArrowLayer);
|
452 |
| - |
| 452 | + |
453 | 453 | //change active bullet
|
454 | 454 | oldHelperLayer.querySelector('.introjs-bullets li > a.active').className = '';
|
455 | 455 | oldHelperLayer.querySelector('.introjs-bullets li > a[data-stepnumber="' + targetElement.step + '"]').className = 'active';
|
|
478 | 478 |
|
479 | 479 | tooltipTextLayer.className = 'introjs-tooltiptext';
|
480 | 480 | tooltipTextLayer.innerHTML = targetElement.intro;
|
481 |
| - |
| 481 | + |
482 | 482 | bulletsLayer.className = 'introjs-bullets';
|
483 | 483 |
|
484 | 484 | if (this._options.showBullets === false) {
|
|
611 | 611 |
|
612 | 612 | var parentElm = targetElement.element.parentNode;
|
613 | 613 | while (parentElm != null) {
|
614 |
| - if (parentElm.tagName.toLowerCase() === 'body') break; |
| 614 | + if (parentElm.tagName.toLowerCase() === 'body' || parentElm.tagName.toLowerCase() === 'html') break; |
615 | 615 |
|
616 | 616 | var zIndex = _getPropValue(parentElm, 'z-index');
|
617 | 617 | if (/[0-9]+/.test(zIndex)) {
|
|
620 | 620 | parentElm = parentElm.parentNode;
|
621 | 621 | }
|
622 | 622 |
|
623 |
| - if (!_elementInViewport(targetElement.element)) { |
| 623 | + if (targetElement.element.tagName.toLowerCase() === 'body') { |
| 624 | + window.scrollTo(0, 0) // scroll to top when highlighting the whole page |
| 625 | + |
| 626 | + } else if (!_elementInViewport(targetElement.element)) { |
624 | 627 | var rect = targetElement.element.getBoundingClientRect(),
|
625 | 628 | winHeight=_getWinSize().height,
|
626 | 629 | top = rect.bottom - (rect.bottom - rect.top),
|
|
0 commit comments