diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-03 15:24:57 -0700 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-03 15:24:57 -0700 |
commit | c934238f3d877e7f774a4b9ec4f33a5342e3914b (patch) | |
tree | 0b03fab93550cfc93cdaa971d2fc222aa8f08e67 /assets/javascript/core/navigation.js | |
parent | ab489599688f53df5cb53c1661c53e5e320269ad (diff) | |
download | gitbook-c934238f3d877e7f774a4b9ec4f33a5342e3914b.zip gitbook-c934238f3d877e7f774a4b9ec4f33a5342e3914b.tar.gz gitbook-c934238f3d877e7f774a4b9ec4f33a5342e3914b.tar.bz2 |
Fix #9: add keyboard navigation using right/left
Diffstat (limited to 'assets/javascript/core/navigation.js')
-rw-r--r-- | assets/javascript/core/navigation.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/assets/javascript/core/navigation.js b/assets/javascript/core/navigation.js new file mode 100644 index 0000000..bb3547c --- /dev/null +++ b/assets/javascript/core/navigation.js @@ -0,0 +1,17 @@ +define([ + "jQuery" +], function($) { + var goNext = function() { + var url = $("link[rel='next']").attr("href"); + if (url) location.href = url; + }; + var goPrev = function() { + var url = $("link[rel='prev']").attr("href"); + if (url) location.href = url; + }; + + return { + goNext: goNext, + goPrev: goPrev + }; +});
\ No newline at end of file |