【问题标题】:Keyboard event left/right arrow in jqPlotjqPlot中的键盘事件左/右箭头
【发布时间】:2013-09-10 11:33:42
【问题描述】:

我想制作一个工具提示来响应按键(左/右)。如何以类似的方式添加事件:

$.jqplot.eventListenerHooks.push(['jqplotClick', handleClick]);

我需要在事件中获取“情节”对象。

【问题讨论】:

    标签: events jqplot keypress keydown


    【解决方案1】:

    您可能想从checking out one of my other answers 开始,然后查看那里的代码示例。它提供了一种监听键盘事件的方法。 归结为以下代码:

    $(document).keydown(function(e) {
        if (e.keyCode == 37) {
            //on left arrow key down 
        }
        else if (e.keyCode == 39) {
            //on right arrow key down
        }
    });
    

    请记住,要让示例响应键,必须选择 jsfiddle 上的“结果”区域。

    就我个人而言,我会使用自定义的工具提示,以便更好地控制它。如何做到这一点,例如,在this answer 中介绍。

    【讨论】:

      猜你喜欢
      • 2013-10-21
      • 1970-01-01
      • 2011-11-21
      • 2018-08-25
      • 1970-01-01
      • 2014-01-19
      • 2014-06-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多