Jeg
Sat Apr 23, 2022 6:10 pm
Jeg
Sat Apr 23, 2022 6:24 pm
Differentiate and customize external and local links
- Spoiler:
- Create a new javascript on all the pages and add the following code:
- Code:
$(function() {
$('.postbody div a').each(function() {
if(location.hostname === this.hostname || !this.hostname.length) {
$(this).addClass('internal-link');
} else {
$(this).addClass('external-link');
}
});
});
Each external link will now have a external-link class while local-internal links will have a internal-link class. You can customize them however you want.
Example (this one requires Material Design Icons):
- Code:
a.external-link::after {
content: "\F03CC";
font-family: 'Material Design Icons';
margin-left: 2px;
display: inline-block;
color: #9f2424;
font-size: 10pt;
vertical-align: super;
}
|
|