diff options
author | Arun Persaud <arun@nubati.net> | 2012-11-17 15:09:31 -0800 |
---|---|---|
committer | Arun Persaud <arun@nubati.net> | 2012-11-17 15:09:31 -0800 |
commit | 68246bb37ea3eaba59e3fb6af80d541bfd345f38 (patch) | |
tree | 06a65c13018ec825572002882e6d0722b6bb1e51 | |
parent | 0016cfb185872b6de1050f542e7c6b8e20e20f77 (diff) | |
download | photo-tags-68246bb37ea3eaba59e3fb6af80d541bfd345f38.tar.gz photo-tags-68246bb37ea3eaba59e3fb6af80d541bfd345f38.tar.bz2 photo-tags-68246bb37ea3eaba59e3fb6af80d541bfd345f38.zip |
add keyboard shortcuts for prev/next image
-rw-r--r-- | js/photo-tags.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/js/photo-tags.js b/js/photo-tags.js index 2b21eb5..238575d 100644 --- a/js/photo-tags.js +++ b/js/photo-tags.js @@ -219,9 +219,15 @@ function update_thumbnails(){ if (IDprev != -1 ) d3.select(".left" ).on("click", function() { load_pic(IDprev); }); if (IDnext != -1 ) - d3.select(".right").on("click", function() { load_pic(IDnext); }); - - }); + d3.select(".right").on("click", function() { load_pic(IDnext); }); + + /* keyboard shortcuts */ + $(document) + .keydown( function (e) { + if(e.which == 37 && IDprev != -1) { $(document).unbind('keydown'); load_pic(IDprev); } + if(e.which == 39 && IDnext != -1) { $(document).unbind('keydown'); load_pic(IDnext); } + }); + }); } function checkbutton() |