Created
February 6, 2015 04:03
-
-
Save kevinlisota/83d3b73742026eccec70 to your computer and use it in GitHub Desktop.
Right-click on navbar logo redirect to logos page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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