diff --git a/lib/ComicBook.js b/lib/ComicBook.js index 6c53eac..4951afb 100755 --- a/lib/ComicBook.js +++ b/lib/ComicBook.js @@ -52,7 +52,10 @@ function ComicBook(id, srcs, opts) { enhance: {}, keyboard: { next: 78, - previous: 80 + previous: 80, + control: { + image: 69 + } } }; @@ -250,6 +253,14 @@ function ComicBook(id, srcs, opts) { ComicBook.prototype.hideControl = function(control) { this.getControl(control).hide(); } + + ComicBook.prototype.toggleControl = function(control) { + if (this.getControl(control).is(":visible")) { + this.hideControl(control); + } else { + this.showControl(control); + } + } /** * Get the image for a given page. @@ -592,8 +603,12 @@ function ComicBook(id, srcs, opts) { side = getCursorPosition(e); break; case "keydown": + if (e.keyCode === options.keyboard.previous) { side = "left"; } if (e.keyCode === options.keyboard.next) { side = "right"; } + if (e.keyCode === options.keyboard.control.image) { + ComicBook.prototype.toggleControl("image"); + } break; default: throw "invalid navigation event: " + e.type;