开发者

jQuery slideToggle

I have this jquery code which displays my div and hides it no problem but im having trouble changing it from css display to slideToggle display?

$('l开发者_运维技巧i.trigger').hover(
        function() { $(this).css('background-color', '#fff'); $('div', this).css('display', 'block'); },
        function() { $(this).css('background-color', '#fff'); $('div', this).css('display', 'none'); });


Give this a go, if u dnt need to slide the divs then just move .slideUp() to the line above same with 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(); 
         });


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

});


Heres what worked

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜