Created
May 1, 2009 00:49
-
-
Save collectiveidea/104791 to your computer and use it in GitHub Desktop.
display favicons next to links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requires prototype.js | |
// assumes you have some container with class .favicon with a bunch of links inside | |
// As seen on http://ideafoundry.info/embassy | |
// Documentation at http://daniel.collectiveidea.com/blog/2009/5/1/fun-with-favicons | |
function loadFavicons() { | |
$$('.favicon a').each(function(link){ | |
link.setStyle({ | |
background: 'url('+link.href+'favicon.ico) no-repeat 0 0', | |
paddingLeft: '24px' | |
}); | |
link.setStyle("background-size: 16px; -webkit-background-size: 16px; -khtml-background-size: 16px;"); | |
}); | |
} | |
Event.observe(window, "dom:loaded", loadFavicons) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment