0

我有这个 jquery 代码,它显示我的 div 并隐藏它没问题,但我无法将它从 css 显示更改为 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'); });
4

3 回答 3

1

试一试,如果你不需要滑动divs,那么只需移动.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(); 
         });
于 2011-02-24T15:39:47.000 回答
0
$('li.trigger').hover(
        function() { $(this).css('background-color', '#0099ff');
 $('div', this).css('display', 'block').slideToggle("slow"); 

});
于 2011-02-24T15:22:51.880 回答
-1

继承人什么有效

$('li.trigger').hover(
    function() { $(this).css('background-color', '#fff');$('div', this).slideToggle("slow"); 
});
于 2011-02-24T15:47:02.263 回答