Skip to content

Instantly share code, notes, and snippets.

@meeDamian
Created March 8, 2012 22:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meeDamian/2003935 to your computer and use it in GitHub Desktop.
Save meeDamian/2003935 to your computer and use it in GitHub Desktop.
[jQuery plugin] favicon prepender
// jQuery plugin prepending chosen <a>'s with favicon
(function($){$.fn.preFav=function(){$(this).css('background','url('+$(this).attr('href').replace(/^(http:\/\/[^\/]+).*$/,'$1') +'/favicon.ico'+') no-repeat 0 0').css('padding-left','18px');};})(jQuery);
// usage:
$('a.fav').preFav();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment