вы можете изменить:
jQuery(this).addClass("selected");
var $banner = jQuery(this).attr("class");
$banner = $banner.replace(" selected","");
на:
var $banner = jQuery(this).attr("class");
jQuery(this).addClass("selected");
, изменив последовательность строк и удалив одну строку $banner
создается сразу после добавления класса «selected» ивы избегаете одной строки.
в этом наборе вы выбираете то, что уже выбрано:
jQuery(".preview img").fadeOut('fast',function() {
jQuery(".preview img").attr("src",
"http://localhost/site/banners/"+$banner+".jpg")
.fadeIn('slow');
});
возможно лучше как:
jQuery(".preview img").fadeOut('fast',function() {
jQuery(this).attr("src",
"http://localhost/site/banners/"+$banner+".jpg")
.fadeIn('slow');
});
переработано:
jQuery(".banner-style li").click(function() {
jQuery(".banner-style li").removeClass("selected");
var $banner = jQuery(this).attr("class");
jQuery(this).addClass("selected");
jQuery(".preview img").fadeOut('fast',function() {
jQuery(this).attr("src",
"http://localhost/site/banners/"+$banner+".jpg")
.fadeIn('slow');
});
jQuery(".code p").removeClass('hide').hide();
jQuery(".code p."+$banner).show();
});
РЕДАКТИРОВАТЬ: Примечание о вашей проблеме с FF, должен был бы увидеть разметку Css, но эта строка мне кажется "странной":
jQuery(".code p").removeClass('hide').hide();