Skip to content

Instantly share code, notes, and snippets.

@hdragomir
Created February 7, 2011 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hdragomir/815116 to your computer and use it in GitHub Desktop.
Save hdragomir/815116 to your computer and use it in GitHub Desktop.
How to block normal click, but let middle (or control-, command- and shift- ) clicking pass through.
$('.some-snazzy-selector').click(function(ev){
if( ev.which == 2 || ev.metaKey || ev.ctrlKey || ev.shiftKey ){
return true;
}
// Ajax Magic here
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment