2011-09-26 54 views

回答

0

據我瞭解你的網站,你有這樣的代碼,不會褪色過渡:

$('nav ul li').not('#line').click(function(){ 
    selected = $(this).attr('id'); 
    $('nav ul li').css({'background': '', 'color': '#999'}); 
    $(this).css({'background': getColor(selected), 'color': '#FFF'}); 

    $('.content').fadeOut('fast', function(){ 
     $(this).html($('div#'+selected).html()); 
     $(this).fadeIn('fast'); 
    }) 

}) 

如果你想讓它滑動,它很可能是更容易使用jQuery UI的。如果你想要像滑動和淡出了左邊,那麼你可以使用jQuery UI的下降過渡來實現:

$('nav ul li').not('#line').click(function(){ 
    selected = $(this).attr('id'); 
    $('nav ul li').css({'background': '', 'color': '#999'}); 
    $(this).css({'background': getColor(selected), 'color': '#FFF'}); 

    $('.content').hide('drop', {direction: 'left'}, 'fast', function(){ 
     $(this).html($('div#'+selected).html()); 
     $(this).show('drop', {direction: 'right'}, 'fast'); 
    }) 

}) 

我明明沒有嘗試運行在您的網站這個確切的代碼,但它肯定會看起來像這樣。

你可以找到更多關於這裏的放置效果:

希望這有助於。 :)