javascript - jQuery - slideDown on mouseenter > delay > SlideUp on mouseleave -
I have created a very simple jQuery sliding function, but need improvement, the original timeline of the function is required: < / P>
- Slide down on the mousester
- Unless the mouse moves
- Be visible
^^ This works, But if you slide up and down several times, the function stops working for a few seconds. Can someone please suggest solutions? JS FIDDLE Attached
JSFIDDLE:
$ (document) .ready (function () {$ hover = true; $ ("#slide") .mouseenter (function ($ Hover = hidden) {$ (".slide - hidden") .Sliddown ('sharp');}}); $ ("#slide") .mouseleave (function () {$ hover = false; $ ( ".slide - hidden") .delay (2000) .slideUp ('fast'). Queue (function () {enableHover (); $ (this) .dequeue ();});}); function enabled () { $ Hover = true;}});
Change your javascript with this if I If you understand your problem properly, then it works very well.
$ (document). Ready (function () {var (the timeout; $ ('# slide'). Mouseover (function () {clearTimeout $ ('slide - hidden'). SlideDown ();}); $ ('# slide') MouseLove (function () (thetimeout = setTimeout {$ ('slide-hidden'). SlideUp ();}, 2000);});});
Comments
Post a Comment