just had the same problem... here is how i would suggest you fix it.

jQuery.noConflict();
jQuery(document).ready( function($) {
        $("#main-menu ul.menu li")
                .mouseover( function() {
                        $(this).children("ul").css("display","block");
                })
                .mouseout( function() {
                        t = setTimeout(function(){
                                $(this).children("ul").css("display","none");   
                                        
                        }, 500); // adjust your time here
                });

                $(this).children("ul").hover(function(){
                        clearTimeout(t);
                },function(){
                        t = setTimeout(function(){
                                $(this).children("ul").css("display","none");   
                                        
                        }, 500); // adjust your time here
                });
});



Bugzilla from scott.viv...@gmail.com wrote:
> 
> 
> I've made a drop-down menu with jQuery which works great, except that
> on mouseout the menu disappears instantly. I'd like it if there was a
> delay before the menu disappeared, in case the user moves the mouse
> out slightly by accident (or when moving to other parts of the menu).
> 
> Here is my current code:
> 
> jQuery.noConflict();
> jQuery(document).ready( function($) {
>       $("#main-menu ul.menu li")
>               .mouseover( function() {
>                       $(this).children("ul").css("display","block");
>               })
>               .mouseout( function() {
>                       $(this).children("ul").css("display","none");
>               });
> });
> 
> I was originally using the fadeIn/fadeOut effect but it proved
> problematic. So I'd just like to call a timeout in the mouseout
> function, followed by the code to hide the menu.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Timeout-sleep-in-jQuery--tp19416499s27240p21490256.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to