PDA

View Full Version : Small fix for jQuery Drop Line Menu



macieQ82
10-14-2011, 08:32 AM
1) Script Title: jQuery Drop Line Menu

2) Script URL (on DD): Script URL (http://www.dynamicdrive.com/style/csslibrary/item/jquery_drop_line_menu/)

3) Describe problem: When You move mouse very fast betwen 2 menu elements submenu will disapear after some time or height of sub menu will be to small to display whole submenu.

EXPLANATION:

Problem comes from jQuery dequeue() function withc is used before each animation efect (on mouse hover). According to documentation, dequeue() function remove next function (in this script prevoius unfinished annimation) from queue. Because of that when animation is not finished dequeue function stops that animation for e.g. in the middle. Height of submenu element in the middle of animation is only helf. For next repat of that animation targeted height is not a full height but that half. After few fast moves of mouse over menu elements that height can be redused to 0. To avoid this problem You should use jQuery stop() function with arguments like this:

stop(false, true)
False says not to dequeue.
True says immediately finish (jump to end) previous function (in our case annimation).
For our script it means that height always will be full height.

FIX:

To applay that fix You have to change this line:

$targetul.dequeue().slideDown(droplinemenu.animateduration.over)
Into this:

$targetul.stop(false, true).slideDown(droplinemenu.animateduration.over)
And this line:

$targetul.dequeue().slideUp(droplinemenu.animateduration.out)
Into this:

$targetul.stop(false, true).slideUp(droplinemenu.animateduration.out)
I hope it's helpfull for You.

ddadmin
10-15-2011, 12:59 AM
Thanks for the tip- I seem to recall however that usng stop() in the aformentioned config also has its own set of problems, which is why I had switched over to using dequeue() instead. I could be mistaken, however. I could be thinking of another script though. I'll give this a shot later in the weekend.

D72
04-21-2012, 08:29 PM
Thank you! This is really a helpful fix.
Kinda surprised that the original script still isn't fixed yet.
Thanks Macie