Skip to content

Instantly share code, notes, and snippets.

@tyx
Created February 8, 2011 09:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tyx/816180 to your computer and use it in GitHub Desktop.
Save tyx/816180 to your computer and use it in GitHub Desktop.
// Ouvre le premier lien enfant de l'élément cible
// Reproduit le comportement des navigateurs (ctrl ou cmd ou middleclick = nouvel onglet)
$('.line-click').live('click', function(e){
e.stopPropagation();
href = $(this).children('a:first').attr('href');
if (e.ctrlKey || e.metaKey || e.which == 2) {
window.open(href);
} else {
window.location = href;
}
}).css('cursor', 'pointer');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment