Try the setTimeout function
2009/6/2 zayatzz <[email protected]>
>
> Hello
>
> Is it possible to mouseleave event have some kind of delay inserted
> into it?
>
> I have this small script, which is working just fine :
>
> <script type="text/javascript">
> $(document).ready(function () {
> $("ul.LvlOne
> li:has(ul)").bind("mouseenter",function(event){
> $("ul.LvlTwo").slideToggle('medium');
> });
> $("ul.LvlOne
> li:has(ul)").bind("mouseleave",function(event){
> $("ul.LvlTwo").slideToggle('medium');
> });
> });
> </script>
>
> The problem is that the menu that opens is quite long and visitors of
> the site (me among them) move cursor down where menu is supposed to
> end up when its fully opened, but since the menu has not reached this
> far, the mouseleave event fires. When computer or browser is slow you
> can see even stranger thing.
>
> Menu gets mouseleave event and starts closing, but not before menu
> reaches the cursor. That means the menu gets mouseleave, then
> mouseenter, does not reach cursor before mouseleave event fires, then
> gets mouseenter again and keeps closing/opening/closing/opening/
> closing/opening forever.
>
> So what i want to know, if it is possible to insert some kind of
> delays or doublechecks into the system to stop this kind of stuff from
> happening or should i just tell everybody to slow down their mouse
> movement?
>
> Alan
>
--
Gustavo Salome Silva