One thing I've been working on lately is a neat code that allows me to swap prefixes of images, all thanks to the help I received from maniator!
$(function() {
$('img.swap').each(function(){
$(this).data('current_image', this.src);
})
$('a').click(function(){
var prefix = $(this).attr("class");
$('img.swap').each(
function() {
if($(this).data('prefix') != prefix){
this.src = $(this).data('current_image').replace('.gif', (prefix)+'.gif');
$(this).data('prefix', prefix);
}
else {
this.src = $(this).data('current_image');
$(this).data('prefix', '');
}
});
});
});
A question just popped up in my mind - I wonder if it's possible to apply the same prefix being added to the image to a specific CSS file? For example, instead of color.css could I use color_bw.css?
Thanks a bunch!