|
53 | 53 | /* Show tour control buttons? */
|
54 | 54 | showButtons: true,
|
55 | 55 | /* Show tour bullets? */
|
56 |
| - showBullets: true |
| 56 | + showBullets: true, |
| 57 | + /* Scroll to highlighted element? */ |
| 58 | + scrollToElement: true |
57 | 59 | };
|
58 | 60 | }
|
59 | 61 |
|
|
116 | 118 | var currentElement = allIntroSteps[i];
|
117 | 119 |
|
118 | 120 | if (currentElement.getAttribute('data-step') == null) {
|
119 |
| - |
| 121 | + |
120 | 122 | while (true) {
|
121 | 123 | if (typeof introItems[nextStep] == 'undefined') {
|
122 | 124 | break;
|
|
141 | 143 | for (var z = 0; z < introItems.length; z++) {
|
142 | 144 | introItems[z] && tempIntroItems.push(introItems[z]); // copy non-empty values to the end of the array
|
143 | 145 | }
|
144 |
| - |
| 146 | + |
145 | 147 | introItems = tempIntroItems;
|
146 | 148 |
|
147 | 149 | //Ok, sort all items with given steps
|
|
418 | 420 | skipTooltipButton = oldHelperLayer.querySelector('.introjs-skipbutton'),
|
419 | 421 | prevTooltipButton = oldHelperLayer.querySelector('.introjs-prevbutton'),
|
420 | 422 | nextTooltipButton = oldHelperLayer.querySelector('.introjs-nextbutton');
|
421 |
| - |
| 423 | + |
422 | 424 | //hide the tooltip
|
423 | 425 | oldtooltipContainer.style.opacity = 0;
|
424 | 426 |
|
|
449 | 451 | oldtooltipLayer.innerHTML = targetElement.intro;
|
450 | 452 | //set the tooltip position
|
451 | 453 | _placeTooltip.call(self, targetElement.element, oldtooltipContainer, oldArrowLayer);
|
452 |
| - |
| 454 | + |
453 | 455 | //change active bullet
|
454 | 456 | oldHelperLayer.querySelector('.introjs-bullets li > a.active').className = '';
|
455 | 457 | oldHelperLayer.querySelector('.introjs-bullets li > a[data-stepnumber="' + targetElement.step + '"]').className = 'active';
|
|
478 | 480 |
|
479 | 481 | tooltipTextLayer.className = 'introjs-tooltiptext';
|
480 | 482 | tooltipTextLayer.innerHTML = targetElement.intro;
|
481 |
| - |
| 483 | + |
482 | 484 | bulletsLayer.className = 'introjs-bullets';
|
483 | 485 |
|
484 | 486 | if (this._options.showBullets === false) {
|
|
620 | 622 | parentElm = parentElm.parentNode;
|
621 | 623 | }
|
622 | 624 |
|
623 |
| - if (!_elementInViewport(targetElement.element)) { |
| 625 | + if (!_elementInViewport(targetElement.element) && this._options.scrollToElement === true) { |
624 | 626 | var rect = targetElement.element.getBoundingClientRect(),
|
625 | 627 | winHeight=_getWinSize().height,
|
626 | 628 | top = rect.bottom - (rect.bottom - rect.top),
|
|
0 commit comments