jQuery Plugin For Automatically Adding Classes To Links

File Size: 96KB
Views Total: 533
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
jQuery Plugin For Automatically Adding Classes To Links

Link Classifier is an easy but useful jQuery plugin that enables you to automatically adds some predefined classes to the links of your page. For instance, with this plugin, you can make the external links look different from the Internal links on your website.

How to use it:

1. Include jQuery library and jQuery Link Classifier on the page

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://livibetter.github.com/jquery.link.classifier.js/jquery.link.classifier.min.js"></script>

2. Call the plugin


3. Some samples. The original HTML source of these links do not have any classes specified

<a href="https://github.com/livibetter/jquery.link.classifier.js" class="js github https lc">jQuery Link Classifier</a>
<a href="http://en.wikipedia.org/wiki/Wikipedia#External_links" class="wikipedia http lc">Wikipedia</a>
<a href="ftp://ftp.kernel.org/pub/" class="ftp lc">Linux Kernel</a>
<a href="irc://irc.gentoo.org/gentoo" class="org/gentoo irc lc">#gentoo</a>
<a href="mailto:[email protected]" class="com mailto lc">[email protected]</a>
<a href="http://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png" class="png http lc">Tux</a>
<a href="http://twitter.com" class="twitter http lc">Twitter</a>
<a href="http://facebook.com/" class="facebook http lc">Facebook</a>
<a href="http://plus.google.com/" class="gplus http lc">Google+</a>
<a href="#try-a-link" class="in-page html file lc">next section</a>

This awesome jQuery plugin is developed by livibetter. For more Advanced Usages, please check the demo page or visit the official website.