Skip to content

Commit

Permalink
Add mouse wheel click trigger.
Browse files Browse the repository at this point in the history
  • Loading branch information
AliagaDev committed Apr 16, 2020
1 parent 4a65fc8 commit 09a415a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions inheritlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,19 @@
if (hideElement) {
$(first).hide();
}
$(link_element).click(function (e) {
// Prevent loop and preserve any other click action (not first).
$(link_element).on("mouseup click",function(e) {
if (!$(e.target).is(first) && !$(e.target).is(linkSelector)) {
$(first)[0].click();
// Left: 1, middle: 2, right 3.
switch (e.which) {
case 1:
$(first)[0].click();
break;
case 2:
$(first).clone().attr('target', '_blank')[0].click();
break;
}
}
return true;
});
}
};
Expand Down

0 comments on commit 09a415a

Please sign in to comment.