jquery - Why HoverIntent is not working? -


I am trying to create a dropdown menu, but I have some problems with the HoverTent instructions.

Javascript code:

  $ ('li.dropdown'). HoverIntent (function () {$ (this) .find ('ul.submenu'). SlideDown ();}, function () {$ (this) .fund ('.ub submenu'). SlideUp ();}) ;   

HTML code:

  & lt; Div id = "div_menu" & gt; & Lt; Ul class = "menu" & gt; & Lt; Li class = "leaf" & gt; & Lt; A href = "#" style = "color: # 2154a3;" & Gt; Iniki & lt; / A & gt; & Lt; / Li & gt; & Lt; Li class = "dropdown" & gt; & Lt; A href = "#" & gt; Factats & lt; / A & gt; & Lt; Ul class = "submenu" & gt; & Lt; Li style = "margin: 3px; limit: none;" & Gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; IUs & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; UIC & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; UPF & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; ESCI & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; Li class = "leaf" & gt; & Lt; A href = ". / Instalaciones.html" & gt; Install lacions & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "" & gt; Contact and & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt;   

CSS code:

  .leaf {border-right: solid 1px # 333; } .dropdown {border-right: solid 1px # 333; }   

This works correctly with the hover function, but if I "take" the mouse, then it slides down properly, but after that If I take the mouse out and re-enter it again it will be sliding up and down again. It seems that if every incident is a happy stack!

As is proposed in the example, you can see the stop You can use it to ensure that the additional animation you do not want will not be executed.

  $ ('ul.submenu'). ); / * Hide the menu when the page loads * / $ ('li.dropdown') Focus (function () {$ ('ul.submenu'). Stop (True, False) .slideToggle ();});   

The first argument (true) clears the queue, the second argument (false) closes the current animation just now.

Comments