public
Last active

[jQuery plugin] favicon prepender

  • Download Gist
favicon.js
JavaScript
1 2 3 4 5
// 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();

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.