0

I need a navigation that when I mouse out, waits for 1 sec, and then hide,

I got my code here

http://jsfiddle.net/xR83q/

but it does not work correctly

Can you please tell me what I'm doing wrong?

Omegakenshin
  • 311
  • 3
  • 14

1 Answers1

1

Use mouseenter and mouseleave instead - change the last 2 lines to:

$j('#menu-navegacion-principal > li')
    .bind('mouseenter', navIn)
    .bind('mouseleave', navOut);

$j('#menu-navegacion-principal > li:has(ul)')
    .bind('mouseenter', navInS)
    .bind('mouseleave', navOutS)
mway
  • 4,334
  • 3
  • 26
  • 37
  • Thanks for the answer, but I try it and still doesn't fix the hover not to hide on the right time. – Omegakenshin Mar 28 '11 at 20:29
  • Chrome, and now I find out what was the problem, the line with $("#"+_CancelBtn).hide(); , need it to be $j instead of $, thanks for your time ^^ – Omegakenshin Mar 28 '11 at 21:09
  • No probs. you should still use `mouseenter` and `mouseleave` for this particular case though. :) Glad you got it sorted! – mway Mar 28 '11 at 21:26
  • Whats the diference between a "hover" and bind a "mounseenter or mouseleave"? do I have any benefits? – Omegakenshin May 02 '11 at 16:28
  • The hover event will fire mouseout when a child element is mouseover'd, whereas using mouseenter mouseleave will properly account for children so that events don't mis-bubble and trigger unexpected events. – mway May 02 '11 at 16:45