2011-02-24 87 views
0

我有這個jquery代碼,它顯示我的div並隱藏它沒有問題,但即時通訊無法從css顯示更改爲slideToggle顯示?jQuery slideToggle

$('li.trigger').hover(
     function() { $(this).css('background-color', '#fff'); $('div', this).css('display', 'block'); }, 
     function() { $(this).css('background-color', '#fff'); $('div', this).css('display', 'none'); }); 
+0

究竟發生了什麼? – Serge 2011-02-24 15:15:45

+0

你想滑動切換每次他們把mouseenter或mouseenter /離開,因爲你的鼠標進入第一個鼠標滑過它隱藏,然後第二次,它滑動它可見,等滑動它等 – Val 2011-02-24 15:17:08

+0

對不起,請參閱上面的編輯。這個工程只改變了CSS顯示模塊,並且不顯示任何內容,但是我希望它滑動切換在mouseover上打開並在mouseout上滑動關閉 – user520300 2011-02-24 15:20:53

回答

0
$('li.trigger').hover(
     function() { $(this).css('background-color', '#0099ff'); 
$('div', this).css('display', 'block').slideToggle("slow"); 

}); 
1

這給一去,如果u天璣需要滑動div當時的正義之舉.slideUp()上述相同的符合slideDown

$('li.trigger').hover(
     function() { 
      $(this).css('background-color', '#fff'); 
      $('div', this).css('display', 'block').slideUp(); 
     }, 
     function() { 
      $(this).css('background-color', '#fff'); 
      $('div', this).css('display', 'none').slideDown(); 
     }); 
-1

下面有什麼工作

$('li.trigger').hover(
    function() { $(this).css('background-color', '#fff');$('div', this).slideToggle("slow"); 
}); 
+0

您的答案與以前的帖子基本相同;請不要重複其他答案,除非你的方法有很大的不同。 – phooji 2011-06-21 01:25:46