Jquery run a shortcut

1

I need to run this shortcut to minimize the screen:

Alt + shift + n

Is there a way to do this after a click button?

$("#btnVoltar").click(function(){
    var ALT =   18;
    var space = 32;
    var n = 78;
.....
    
asked by anonymous 09.03.2017 / 15:57

1 answer

0

This code does this:

var press = jQuery.Event("keypress");
press.which = 78;  // tecla n
press.shiftKey = true;  // shift pressionado
press.altKey = true;  // alt pressionado
$("algumElemento").trigger(press);  // aqui "dispara" as teclas sobre algum elemento

I hope it helps.

    
09.03.2017 / 16:13