Fix bug where we would not check if there was actually a page to navigate to when using arrow keys
This commit is contained in:
parent
98cd2f0c27
commit
ae6334f358
|
@ -32,11 +32,15 @@ $( document ).ready(function() {
|
||||||
switch (e.keyCode) {
|
switch (e.keyCode) {
|
||||||
case KEY_CODES.NEXT_KEY:
|
case KEY_CODES.NEXT_KEY:
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.location.href = $('.nav-chapters.next').attr('href');
|
if($('.nav-chapters.next').length) {
|
||||||
|
window.location.href = $('.nav-chapters.next').attr('href');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case KEY_CODES.PREVIOUS_KEY:
|
case KEY_CODES.PREVIOUS_KEY:
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.location.href = $('.nav-chapters.previous').attr('href');
|
if($('.nav-chapters.previous').length) {
|
||||||
|
window.location.href = $('.nav-chapters.previous').attr('href');
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue