【问题标题】:Jquery: click to trigger a keydown eventJquery:点击触发keydown事件
【发布时间】:2013-06-28 17:13:58
【问题描述】:

如何在单击按钮时触发 keydown 事件?

var e = jQuery.Event("keydown");
    e.which = 122; // # Some key code value

    $('.button-fullscreen').click(function(){
        $(window).trigger(e);
        return false;
    });

我想在点击按钮时触发键盘上的F11键。有可能吗?

【问题讨论】:

标签: jquery fullscreen onkeydown eventtrigger


【解决方案1】:

您可以尝试这样的方法并将其调整为 122:

Is it possible to simulate key press events programmatically?

否则,如果您尝试全屏 - 为什么同时使用 F11?:

How to make the window full screen with Javascript (stretching all over the screen)

【讨论】:

猜你喜欢
  • 2011-11-19
  • 2016-09-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-29
  • 2012-02-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多