|
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
|
|
420 | 422 | skipTooltipButton = oldHelperLayer.querySelector('.introjs-skipbutton'),
|
421 | 423 | prevTooltipButton = oldHelperLayer.querySelector('.introjs-prevbutton'),
|
422 | 424 | nextTooltipButton = oldHelperLayer.querySelector('.introjs-nextbutton');
|
423 |
| - |
| 425 | + |
424 | 426 | //hide the tooltip
|
425 | 427 | oldtooltipContainer.style.opacity = 0;
|
426 | 428 |
|
|
451 | 453 | oldtooltipLayer.innerHTML = targetElement.intro;
|
452 | 454 | //set the tooltip position
|
453 | 455 | _placeTooltip.call(self, targetElement.element, oldtooltipContainer, oldArrowLayer);
|
454 |
| - |
| 456 | + |
455 | 457 | //change active bullet
|
456 | 458 | oldHelperLayer.querySelector('.introjs-bullets li > a.active').className = '';
|
457 | 459 | oldHelperLayer.querySelector('.introjs-bullets li > a[data-stepnumber="' + targetElement.step + '"]').className = 'active';
|
|
480 | 482 |
|
481 | 483 | tooltipTextLayer.className = 'introjs-tooltiptext';
|
482 | 484 | tooltipTextLayer.innerHTML = targetElement.intro;
|
483 |
| - |
| 485 | + |
484 | 486 | bulletsLayer.className = 'introjs-bullets';
|
485 | 487 |
|
486 | 488 | if (this._options.showBullets === false) {
|
|
622 | 624 | parentElm = parentElm.parentNode;
|
623 | 625 | }
|
624 | 626 |
|
625 |
| - if (!_elementInViewport(targetElement.element)) { |
| 627 | + if (!_elementInViewport(targetElement.element) && this._options.scrollToElement === true) { |
626 | 628 | var rect = targetElement.element.getBoundingClientRect(),
|
627 | 629 | winHeight=_getWinSize().height,
|
628 | 630 | top = rect.bottom - (rect.bottom - rect.top),
|
|
0 commit comments