如何处理"left"和“;right"键在原型上

How handle "left" and "right" key on Prototype?

本文关键字:quot right 原型 处理 何处理 left      更新时间:2023-09-26

我需要在原型上操作"左"answers"右"键,比如http://mangastream.com/

就像:

$(document).observe('keydown', function (e) {
    switch (e.keyCode) {
        case Event.KEY_LEFT:
            e.stop(); // prevent the default action, like horizontal scroll
            window.location = '/read/prev';
            break;
        case Event.KEY_RIGHT:
            e.stop();
            window.location = '/read/next';
            break;
    }
});
http://jsfiddle.net/pMts6/

Event.KEY_LEFTEvent.KEY_RIGHT是对应键的数字代码的方便常数。

>>

>