jQuery function on keyboard zoomin zoomout

Below is the script to run jQuery function on using keyboard ‘Ctrl + “+”‘,’Ctrl + “-“‘ and ‘Ctrl + “0”‘

jQuery(window).on(‘keypress keydown’,function(e){
if((e.which == 61 && 17) || (e.which == 43 && 17) || (e.which == 45 && 17) || (e.which == 48 && 17) || (e.which == 96 && 17)){
// 17 is Ctrl Keycode
//Ctrl + “+” is pressed, 61 is for =/+ and 43 is for Numpad + key
//Ctrl + “-” is pressed, 45 is for -/- and 45 is for Numpad – key
//Ctrl + “0” is pressed, 48 is for )/0 and 96 is for Numpad 0 key
alert(e.which);
}
});

Leave a comment