add navigation by arrows
This commit is contained in:
parent
8a4d744dc1
commit
43eef7637a
|
@ -23,6 +23,23 @@ $( document ).ready(function() {
|
||||||
hljs.highlightBlock(block);
|
hljs.highlightBlock(block);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var KEY_CODES = {
|
||||||
|
PREVIOUS_KEY: 37,
|
||||||
|
NEXT_KEY: 39
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).on('keydown', function (e) {
|
||||||
|
switch (e.keyCode) {
|
||||||
|
case KEY_CODES.NEXT_KEY:
|
||||||
|
e.preventDefault();
|
||||||
|
window.location.href = $('.nav-chapters.next').attr('href');
|
||||||
|
break;
|
||||||
|
case KEY_CODES.PREVIOUS_KEY:
|
||||||
|
e.preventDefault();
|
||||||
|
window.location.href = $('.nav-chapters.previous').attr('href');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Interesting DOM Elements
|
// Interesting DOM Elements
|
||||||
var html = $("html");
|
var html = $("html");
|
||||||
|
|
|
@ -84,13 +84,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#previous}}
|
{{#previous}}
|
||||||
<a href="{{link}}" class="nav-chapters previous">
|
<a href="{{link}}" class="nav-chapters previous" title="←">
|
||||||
<i class="fa fa-angle-left"></i>
|
<i class="fa fa-angle-left"></i>
|
||||||
</a>
|
</a>
|
||||||
{{/previous}}
|
{{/previous}}
|
||||||
|
|
||||||
{{#next}}
|
{{#next}}
|
||||||
<a href="{{link}}" class="nav-chapters next">
|
<a href="{{link}}" class="nav-chapters next" title="→">
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
{{/next}}
|
{{/next}}
|
||||||
|
|
Loading…
Reference in New Issue