The jquery.hotkeys plugin lets you easily add and remove handlers for keyboard events. However, this plugin can handle keyboard event only but not mouse click event. So it does not support something like:
$('#gallery li.icon').bind('click', 'ctrl+leftbutton', function() {
$(this).addClass('selected');
});
I know this is not difficult to implement, but I am curious if someone has already posted a neat solution for this.
You can just check the event’s
.ctrlKeyproperty for this, for example:In this we’re just checking if the Ctrl key is down then the
clickevent happened. Just to be clear,.ctrlKeyis basic JavaScript, there’s no dependency on the hotkeys plugin.