IEでは透明なPNGをフェードできないため、ユーザーがIEを使用している場合は単にPNGを表示し、他のブラウザーを使用している場合はフェードするように関数を変更することにしました。以下の関数はIEで正常に動作し、期待どおりに動作しますが、Firefox、Safariなどの他のブラウザーでは何も実行されません。何かが足りないのでしょうか、それとも構文エラーが発生するのでしょうか。
$('#content2 a').click(function(){
if($.browser.msie){
var toLoad = $(this).attr('href')+' #content';
$('#content').show(loadContent);
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').show();
}
return false;
}else{
var toLoad = $(this).attr('href')+' #content';
$('#content').fadeOut('slow',loadContent);
$('#load').remove();
$('#wrapper').append('<span id="load">LOADING...</span>');
$('#load').fadeIn('slow');
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').fadeIn('slow',hideLoader());
}
function hideLoader() {
$('#load').fadeOut('slow');
}
return false;
};
});