由於IE無法淡出透明PNG的我已決定改變我的功能,只需顯示PNG的,如果用戶使用IE瀏覽器,但淡入淡出,如果他們正在使用任何其他瀏覽器。下面的函數在IE中正常工作,並做我期望的功能,但在任何其他瀏覽器,即Firefox,Safari它什麼也不做,我是否缺少某些東西或者是否有語法錯誤?jQuery瀏覽器檢測似乎沒有工作
$('#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;
};
});
確定的其他功能獲取調用? – Broam 2009-11-30 15:06:03
是的,因爲它在IE中工作,並加載外部內容罰款 – 2009-11-30 15:07:34