|
314 | 314 | _exitIntro.call(this, this._targetElement);
|
315 | 315 | } else if (code === 'ArrowLeft' || code === 37) {
|
316 | 316 | //left arrow
|
317 |
| - _previousStep.call(this); |
| 317 | + if (this._currentStep !== 0 && this._introItems.length > 1) { |
| 318 | + _previousStep.call(this); |
| 319 | + } |
318 | 320 | } else if (code === 'ArrowRight' || code === 39) {
|
319 | 321 | //right arrow
|
320 |
| - _nextStep.call(this); |
| 322 | + if (this._introItems.length - 1 !== this._currentStep && this._introItems.length > 1) { |
| 323 | + _nextStep.call(this); |
| 324 | + } |
321 | 325 | } else if (code === 'Enter' || code === 13) {
|
322 | 326 | //srcElement === ie
|
323 | 327 | var target = e.target || e.srcElement;
|
324 | 328 | if (target && target.className.match('introjs-prevbutton')) {
|
325 | 329 | //user hit enter while focusing on previous button
|
326 |
| - _previousStep.call(this); |
| 330 | + if (this._currentStep !== 0 && this._introItems.length > 1) { |
| 331 | + _previousStep.call(this); |
| 332 | + } |
327 | 333 | } else if (target && target.className.match('introjs-skipbutton')) {
|
328 | 334 | //user hit enter while focusing on skip button
|
329 |
| - if (this._introItems.length - 1 === this._currentStep && typeof (this._introCompleteCallback) === 'function') { |
330 |
| - this._introCompleteCallback.call(this); |
| 335 | + if (typeof (this._introSkipCallback) === 'function') { |
| 336 | + this._introSkipCallback.call(this); |
331 | 337 | }
|
332 | 338 |
|
333 | 339 | _exitIntro.call(this, this._targetElement);
|
|
336 | 342 | target.click();
|
337 | 343 | } else {
|
338 | 344 | //default behavior for responding to enter
|
339 |
| - _nextStep.call(this); |
| 345 | + if (this._introItems.length - 1 !== this._currentStep && this._introItems.length > 1) { |
| 346 | + _nextStep.call(this); |
| 347 | + } |
340 | 348 | }
|
341 | 349 |
|
342 | 350 | //prevent default behaviour on hitting Enter, to prevent steps being skipped in some browsers
|
|
0 commit comments