开发者

fadeIn fadeOut, it's not being triggered all the time

开发者 https://www.devze.com 2023-02-02 14:56 出处:网络
I\'m doing a basic .bind(), placing fadei开发者_StackOverflow社区n and fadeout on mouseover and mouseleave,

I'm doing a basic .bind(), placing fadei开发者_StackOverflow社区n and fadeout on mouseover and mouseleave, but it doesn't work all the times. I'm not finding the issue, so I need help or a better sugestion to do this. Thanks for looking, the pastie here http://pastie.org/1433800 and can also check the code below:

        $(function()
        {
            $('#mi_green_media').bind({

                mouseover : function() 
                {
                    $('#sub_menu_content').css('visibility', 'visible').fadeIn(1000);
                }

            });

            $('#sub_menu_content').bind({

                mouseleave : function()
                {
                    $('#sub_menu_content').css('visibility','hidden').fadeOut(1000);
                }

            });

        }
    );


fadeIn and fadeOut automatically set the visibility for you. All you need to do is

$('#sub_menu_content').fadeIn(1000);

and

$('#sub_menu_content').fadeOut(1000);


Instead of using bind() try the live() method too. it attaches a " handler to the event for all elements which match the current selector, now and in the future" link text

0

精彩评论

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