Skip to content

Instantly share code, notes, and snippets.

@kevinlisota
Created February 6, 2015 04:03
Show Gist options
  • Save kevinlisota/83d3b73742026eccec70 to your computer and use it in GitHub Desktop.
Save kevinlisota/83d3b73742026eccec70 to your computer and use it in GitHub Desktop.
Right-click on navbar logo redirect to logos page
// navbar logo redirect
document.addEventListener("contextmenu", function(e) {
var triggerClass = "right-click-redirect",
logosUrl = "/logos/",
$target = $(e.target);
if ($target.hasClass(triggerClass) || $target.parents('.' + triggerClass).length) {
if (window.location.pathname !== logosUrl) {
window.location = logosUrl;
} else {
alert("You can download our logo below");
}
e.preventDefault();
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment