mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-13 14:22:35 +00:00
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
1 changed files with 6 additions and 2 deletions
|
@ -32,11 +32,15 @@ $( document ).ready(function() {
|
|||
switch (e.keyCode) {
|
||||
case KEY_CODES.NEXT_KEY:
|
||||
e.preventDefault();
|
||||
if($('.nav-chapters.next').length) {
|
||||
window.location.href = $('.nav-chapters.next').attr('href');
|
||||
}
|
||||
break;
|
||||
case KEY_CODES.PREVIOUS_KEY:
|
||||
e.preventDefault();
|
||||
if($('.nav-chapters.previous').length) {
|
||||
window.location.href = $('.nav-chapters.previous').attr('href');
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue