Skip to content

Commit 92cea0f

Browse files
author
Yaron Nachshon
committed
fixes
1 parent 463e7ac commit 92cea0f

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

intro.js

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@
230230
};
231231

232232
this.setTarget = function(element){
233+
untrackElementChange(targetElement);
233234
targetElement = $(element);
235+
trackElementChange(targetElement);
234236
};
235237

236238
this.setPosition = function(position){
@@ -246,7 +248,7 @@
246248
};
247249

248250
this.destroy = function(){
249-
untrackElementChange(this.element);
251+
untrackElementChange(that.element);
250252
untrackElementChange(tooltip);
251253
this.element.remove();
252254
tooltip.remove();
@@ -361,6 +363,7 @@
361363

362364
function showStep(step){
363365
var _showStep = function(){
366+
var selectedElement;
364367
var intro;
365368
hint = hint || new Hint();
366369
backdrop = backdrop || createBackdrop();
@@ -370,15 +373,38 @@
370373
}else{
371374
intro = step.intro;
372375
}
373-
if(step.element){
374-
$(step.element).get(0).scrollIntoView(false);
376+
if(step.dynamicElement){
377+
if(typeof step.dynamicElementCounter === 'undefined'){
378+
step.dynamicElementCounter = 0;
379+
}
380+
if($(step.element).length - 1 === step.dynamicElementCounter){
381+
step.dynamicElementCounter = 0;
382+
}
383+
selectedElement = $(step.element).eq(step.dynamicElementCounter);
384+
}else if(step.element){
385+
selectedElement = $(step.element);
375386
}
376-
hint.setTarget(step.element || $('body'));
387+
388+
$(selectedElement).get(0).scrollIntoView(false);
389+
390+
hint.setTarget(selectedElement || $('body'));
377391
hint.setPosition(step.hintPosition);
378392
hint.setTooltipPosition(step.tooltipPosition);
379393
hint.setContent(intro);
380394

381-
highlightElement(step.element, base.options.highlightInteractivity);
395+
if(step.dynamicElement){
396+
if(typeof step.dynamicElementCounter === 'undefined'){
397+
step.dynamicElementCounter = 0;
398+
}
399+
if($(step.element).length - 1 === step.dynamicElementCounter){
400+
step.dynamicElementCounter = 0;
401+
}
402+
highlightElement(selectedElement, base.options.highlightInteractivity);
403+
step.dynamicElementCounter++;
404+
}else{
405+
highlightElement(selectedElement, base.options.highlightInteractivity);
406+
}
407+
382408
if(_.isArray(step.highlightElements)){
383409
_.each(step.highlightElements, function(element){
384410
highlightElement(element, base.options.highlightInteractivity);
@@ -405,9 +431,7 @@
405431
});
406432

407433
base.nextStep = function(){
408-
hideStep(base.currentStep);
409-
currentStepIndex = currentStepIndex + 1;
410-
showStep(base.currentStep);
434+
base.goToStep(currentStepIndex + 1);
411435
};
412436

413437
base.previousStep = function(){
@@ -417,6 +441,7 @@
417441
};
418442

419443
base.goToStep = function(stepIndex) {
444+
hideStep(base.currentStep);
420445
currentStepIndex = stepIndex;
421446
showStep(base.currentStep);
422447
};

introjs.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

introjs.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
$arrow-size-border: 8px;
1313
$arrow-size: $arrow-size-border * 2;
14-
$intro-element-z-index: 1000000;
14+
$intro-element-z-index: 10000000;
1515
$intro-backdrop-z-index: $intro-element-z-index - 100;
1616

1717
@mixin arrow($direction, $color, $size){
@@ -93,6 +93,7 @@ $intro-backdrop-z-index: $intro-element-z-index - 100;
9393
.intro-element {
9494
z-index: $intro-element-z-index !important;
9595
box-shadow: 0 0 1px 1px red;
96+
opacity: 1 !important;
9697

9798
&.intro-element-disabled{
9899
pointer-events: none;

0 commit comments

Comments
 (0)