Skip to content

Latest commit

 

History

History
73 lines (51 loc) · 2.09 KB

README.md

File metadata and controls

73 lines (51 loc) · 2.09 KB

jQuery Favicons Plug-in

Add favicons to anchor elements on your page.

Feel free to check out the examples.

Preview of the plug-in

Requirements

Usage

<script src="https://cdn.rawgit.com/christianv/jquery-favicons/gh-pages/jquery.favicons.min.js"></script>
<script>
  $('a[href^="http://"]').favicons();
</script>

You can download the complete or minified version of the script locally. You're also able to change the jQuery selector a[href^="http://"] to whatever you want.

Configuration

The plug-in accepts 1 argument, which is the config object.

$('a').favicons({
  'classname': 'sakai-favicon',
  'service': 'http://g.etfv.co/__URL__?defaulticon=http://www.google.com/favicon.ico'
});
  • classname: Name of the CSS class (default: "favicon")

  • service: URL of the service you want to use. (default: "http://g.etfv.co/\_\_URL\_\_")

    • __URL__ will be replaced by the complete URL.
    • __DOMAIN__ will be replaced by the domain, which is the URL without http:// or https://.

Features

  • Chainable
$('a').favicons().css('color', '#ff0000');
  • Different services
$('a').favicons({
  'service': 'http://www.getfavicon.org/?url=__DOMAIN__'
});
  • Change default icon
$('a').favicons({
  'service': 'http://g.etfv.co/__URL__?defaulticon=http://www.google.com/favicon.ico'
});

Sites

Sites using this plug-in. Feel free to fork the project and send a pull request to add your site in here.

Inspiration