-
-
Save 01-Scripts/3010527 to your computer and use it in GitHub Desktop.
Show icon after external link using Font Awesome
This file contains hidden or 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
a[href^="http://"]:after { | |
content: "\f08e"; | |
font-family: FontAwesome; | |
font-weight: normal; | |
font-style: normal; | |
display: inline-block; | |
text-decoration: none; | |
padding-left: 3px; | |
} | |
/* Strip from links to own domain or with class no_icon */ | |
a[href^="http://own-domain.com"]:after, | |
a.no_icon:after { | |
content:"" !important; | |
padding-left: 0; | |
} |
@laymonk,
I tryed your script and it works fine!
Could you please give me an example how to exclide the own domain?
Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Caveat: In case we want avoid selecting certain domains in the selector, we add additional inequality selectors .. and if we are trying to exclude many domains, then the use of an array to define the domains and a jquery selector filter may become essential .. the general idea, being to take the logic of conditional selection out of CSS, to JS or jQuery where it should belong