Skip to content

Instantly share code, notes, and snippets.

@gerhard
Created October 5, 2008 07:54
Show Gist options
  • Save gerhard/14860 to your computer and use it in GitHub Desktop.
Save gerhard/14860 to your computer and use it in GitHub Desktop.
function imageReplace(selector) {
$(selector).each(function() {
string = $(this).text();
filename = string.toLowerCase().replace(/ /g, '-').replace(/([^0-9a-z-])/g,'');
$(this).html('');
});
}
$(document).ready(function() {
if($('#logo')[0].offsetWidth == 288) {
$('h2.img').each(function() {
string = $(this).text();
filename = string.toLowerCase().replace(/ /g, '-').replace(/([^0-9a-z-])/g,'');
$(this).html('<img src="/images/' + filename + '.gif" alt="' + string + '" />');
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment