File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,23 @@ $( document ).ready(function() {
2323 hljs . highlightBlock ( block ) ;
2424 } ) ;
2525
26+ var KEY_CODES = {
27+ PREVIOUS_KEY : 37 ,
28+ NEXT_KEY : 39
29+ } ;
30+
31+ $ ( document ) . on ( 'keydown' , function ( e ) {
32+ switch ( e . keyCode ) {
33+ case KEY_CODES . NEXT_KEY :
34+ e . preventDefault ( ) ;
35+ window . location . href = $ ( '.nav-chapters.next' ) . attr ( 'href' ) ;
36+ break ;
37+ case KEY_CODES . PREVIOUS_KEY :
38+ e . preventDefault ( ) ;
39+ window . location . href = $ ( '.nav-chapters.previous' ) . attr ( 'href' ) ;
40+ break ;
41+ }
42+ } ) ;
2643
2744 // Interesting DOM Elements
2845 var html = $ ( "html" ) ;
Original file line number Diff line number Diff line change 8484 </div >
8585
8686 {{ #previous }}
87- <a href =" {{ link }} " class =" nav-chapters previous" >
87+ <a href =" {{ link }} " class =" nav-chapters previous" title = " ← " >
8888 <i class =" fa fa-angle-left" ></i >
8989 </a >
9090 {{ /previous }}
9191
9292 {{ #next }}
93- <a href =" {{ link }} " class =" nav-chapters next" >
93+ <a href =" {{ link }} " class =" nav-chapters next" title = " → " >
9494 <i class =" fa fa-angle-right" ></i >
9595 </a >
9696 {{ /next }}
You can’t perform that action at this time.
0 commit comments