Skip to content

Commit 78b7d3e

Browse files
committed
Better if condition + next step while pressing enter
1 parent 24ca210 commit 78b7d3e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

intro.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,12 @@
6868
if(e.keyCode == 27) {
6969
//escape key pressed, exit the intro
7070
_exitIntro.call(self, targetElm);
71-
}
72-
if([37, 39].indexOf(e.keyCode) >= 0) {
73-
if(e.keyCode == 37) {
74-
//left arrow
75-
_previousStep.call(self);
76-
} else if (e.keyCode == 39) {
77-
//right arrow
78-
_nextStep.call(self);
79-
}
71+
} else if(e.keyCode == 37) {
72+
//left arrow
73+
_previousStep.call(self);
74+
} else if (e.keyCode == 39 || e.keyCode == 13) {
75+
//right arrow or enter
76+
_nextStep.call(self);
8077
}
8178
};
8279
}

0 commit comments

Comments
 (0)