Change page with keyboard.
--HG-- extra : rebase_source : 15d0fc7283e1cab0dcccfe1483d8085f0c2e3309
This commit is contained in:
parent
ae900c4fb5
commit
7f74a172f6
|
@ -42,6 +42,21 @@ Monocle.DEBUG = true;
|
|||
function () { window.reader.resized() }
|
||||
);
|
||||
|
||||
Monocle.Events.listen(window.top.document, 'keyup', function(evt) {
|
||||
var eventCharCode = evt.charCode || evt.keyCode;
|
||||
var dir = null;
|
||||
var flipper = reader.Flipper;
|
||||
if (eventCharCode == 33 || eventCharCode == 37) { // Page down or Left arrow
|
||||
dir = -1;
|
||||
} else if (eventCharCode == 34 || eventCharCode == 39 ) { // Page down or Right arrow
|
||||
dir = 1;
|
||||
}
|
||||
if (dir) {
|
||||
reader.moveTo({ direction: dir });
|
||||
evt.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
/* MAGNIFIER CONTROL */
|
||||
var magnifier = new Monocle.Controls.Magnifier(reader);
|
||||
reader.addControl(magnifier, 'page');
|
||||
|
|
Loading…
Reference in a new issue