Skip to content
This repository was archived by the owner on May 8, 2018. It is now read-only.

Commit 5843611

Browse files
committed
Merge pull request #1 from TrackIF/patches
Patches
2 parents 4f20edc + ad08826 commit 5843611

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

intro.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
element: currentElement,
104104
intro: currentElement.getAttribute('data-intro'),
105105
step: parseInt(currentElement.getAttribute('data-step'), 10),
106-
tooltipClass: currentElement.getAttribute('data-tooltipClass'),
106+
tooltipClass: currentElement.getAttribute('data-tooltipClass'),
107107
position: currentElement.getAttribute('data-position') || this._options.tooltipPosition
108108
};
109109
}
@@ -116,7 +116,7 @@
116116
var currentElement = allIntroSteps[i];
117117

118118
if (currentElement.getAttribute('data-step') == null) {
119-
119+
120120
while (true) {
121121
if (typeof introItems[nextStep] == 'undefined') {
122122
break;
@@ -129,7 +129,7 @@
129129
element: currentElement,
130130
intro: currentElement.getAttribute('data-intro'),
131131
step: nextStep + 1,
132-
tooltipClass: currentElement.getAttribute('data-tooltipClass'),
132+
tooltipClass: currentElement.getAttribute('data-tooltipClass'),
133133
position: currentElement.getAttribute('data-position') || this._options.tooltipPosition
134134
};
135135
}
@@ -141,7 +141,7 @@
141141
for (var z = 0; z < introItems.length; z++) {
142142
introItems[z] && tempIntroItems.push(introItems[z]); // copy non-empty values to the end of the array
143143
}
144-
144+
145145
introItems = tempIntroItems;
146146

147147
//Ok, sort all items with given steps
@@ -418,7 +418,7 @@
418418
skipTooltipButton = oldHelperLayer.querySelector('.introjs-skipbutton'),
419419
prevTooltipButton = oldHelperLayer.querySelector('.introjs-prevbutton'),
420420
nextTooltipButton = oldHelperLayer.querySelector('.introjs-nextbutton');
421-
421+
422422
//hide the tooltip
423423
oldtooltipContainer.style.opacity = 0;
424424

@@ -449,7 +449,7 @@
449449
oldtooltipLayer.innerHTML = targetElement.intro;
450450
//set the tooltip position
451451
_placeTooltip.call(self, targetElement.element, oldtooltipContainer, oldArrowLayer);
452-
452+
453453
//change active bullet
454454
oldHelperLayer.querySelector('.introjs-bullets li > a.active').className = '';
455455
oldHelperLayer.querySelector('.introjs-bullets li > a[data-stepnumber="' + targetElement.step + '"]').className = 'active';
@@ -478,7 +478,7 @@
478478

479479
tooltipTextLayer.className = 'introjs-tooltiptext';
480480
tooltipTextLayer.innerHTML = targetElement.intro;
481-
481+
482482
bulletsLayer.className = 'introjs-bullets';
483483

484484
if (this._options.showBullets === false) {
@@ -611,7 +611,7 @@
611611

612612
var parentElm = targetElement.element.parentNode;
613613
while (parentElm != null) {
614-
if (parentElm.tagName.toLowerCase() === 'body') break;
614+
if (parentElm.tagName.toLowerCase() === 'body' || parentElm.tagName.toLowerCase() === 'html') break;
615615

616616
var zIndex = _getPropValue(parentElm, 'z-index');
617617
if (/[0-9]+/.test(zIndex)) {
@@ -620,7 +620,10 @@
620620
parentElm = parentElm.parentNode;
621621
}
622622

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)) {
624627
var rect = targetElement.element.getBoundingClientRect(),
625628
winHeight=_getWinSize().height,
626629
top = rect.bottom - (rect.bottom - rect.top),

0 commit comments

Comments
 (0)