Skip to content

Instantly share code, notes, and snippets.

View balsoft's full-sized avatar

Alexander Bantyev balsoft

View GitHub Profile
@barneycarroll
barneycarroll / jquery.whichclick.js
Last active May 8, 2018 08:42
Internet Explorer's click event's `which` property won't indicate which mouse button was clicked. To get around this, create distinct `leftclick`, `rightclick` and `middleclick` events which reliably prevent default behaviour. Also creates the `anyclick` event for convenience, which is essentially equivalent to `click` with `event.which` polyfil…
void function whichClickClosure( $ ){
var events = {
1 : 'leftclick',
2 : 'middleclick',
3 : 'rightclick'
},
// List of interruption events for symbolic linking between custom and native events
interrupts = [
'preventDefault',
'stopPropagation',