One of my clients has expressed frustration with the fact that if your cursor slips off the menu, it immediately disappears and they must renavigate the entire menu. Is there any way to add a delay for how long the menu shows after the mouse is not over it? Sorry if this is a simple thing, I know very little programming. Thanks for any help!

Comments

jakeg’s picture

The menu is intended to use as little javascript as possible, partly to keep it lightweight and partly because I know very little javascript! Adding such a feature would no doubt require javascript, if possible at all, so its not something I intend to add any time soon, though I understand your frustration as such a feature would be very useful.

a.k.karthikeyan’s picture

I too have faced the same problem. I tried to fiddle around using setTimeout on mouse over but no luck yet...appreciate if somebody would help..

Thanx

a.k.karthikeyan’s picture

Priority: Normal » Critical

Anybody doing this... i have been trying for the past week and i am not able to get this..... This is a critical feature for my project and my client is insisting on this... any help is deeply appreciated...

justsaynik’s picture

StatusFileSize
new1.52 KB

Please find the attached file "nice_menu.js".

To achieve delay while hiding nice menus, Replace the file
modules->nice_menu->nice_menu.js with this file.

Note: The code is bit raw, but this serves the purpose.

jakeg’s picture

Status: Active » Needs work

Fantastic, thanks for your code. You mention its a little raw, so I won't add it to the module quite yet. I encourage people to try it out though and report back any problems or successes they have with it.

a.k.karthikeyan’s picture

Hi
it works for the first level and from next level on its the same. I think the prevele id is not being tracked properly. I tried an alert on the prevele and saw that the prevele when when on child nodes fills up from child to parent on mouseout. that means the prevele has the parent ids of the element which we are trying to track..

Regards
Karthikeyan

theiviaxx’s picture

JS didn't work for me. It broke the menus in IE and FF had no change. I simply replaced the content of the old nice_menus.js file with the functions you supplied. Not sure if i was supposed to re-enable the module or what.

pjb’s picture

I have the same issue as theiviax; menus no longer worked in IE and FF had no delay. I was using this on the 4.7 version of the module however.

pjb

jakeg’s picture


Please do let me know if anyone gets any further with this. Its a feature a lot of people would like to see. I'm eager to commit it if it can be made to work, but don't have any time/skill to develop the JS myself.

Can JQuery help for the 5.* implementation of the module?

jakeg’s picture

...hoping to get rid of italic text here.

steveoliver’s picture

Version: 4.6.x-1.x-dev » 4.7.x-1.x-dev

This patch appears to make no difference in the functionality of my menus - hmmm... It'll be great when this works

hickory’s picture

Version: 4.7.x-1.x-dev » 6.x-2.x-dev
Priority: Critical » Normal

Seeing as the module uses jQuery now, it should be much easier to have a delay on showing/hiding the menu, which would make it much more usable in my opinion.

PS. Could we have a DRUPAL-5 branch?

Anonymous’s picture

Priority: Normal » Critical

We would like to add a time delay to our nice menu as well. The website is http://www.qahc.org.au/

I have tried the patch that was posted earlier, but it doesn't work in Safari (Mac), Firefox (PC or Mac), and some versions of IE (PC). The latter might be due to our customised CSS menu styles.

cpelham’s picture

We are also experiencing the same problem, although not every time. We are now running Drupal 5RC2 and otherwise all is mostly well. As noted elsewhere Nice Menus is not cooperating with itn18 (our site is bi-lingual English/Japanese). However, we recreated a second menu block in Japanese and switch back and forth. This was a little extra work but does the job just as well. For anyone who would like to take a look, our site is live at:

http://www.crsny.org

We really want to add the menu delay ASAP as some of our users have already said they've given up on trying to navigate down. I'll try to explore solutions myself, but my javascript and php are not very good, and I have a harder time modifying someone else's script than starting from scratch. Also, I know nothing about JQuery. Can anyone tell me if we should be looking to modify the Nice Menus .js file, or whether we should be doing something wth JQuery and/or iFrame (which I also know nothing about)?

Grinin’s picture

Version: 6.x-2.x-dev » 4.7.x-1.x-dev
Component: User interface » Code

I'm about to put a gunshot through my screen... I've been trying all sorts of javascript tricks to get this thing to add some delay but to no avail.

Finally I commented out the following 2 lines:

liNodes[j].onmouseover=function() { addClass(this, 'over'),2000); }
liNodes[j].onmouseout=function() { removeClass(this, 'over'),2000);}

and the code still worked the same?! It doesn't make any sense to me... so I'm giving up for tonight.

Please somebody help find a solution to this. It is impossible to use the menu if there is no delay....

No delay = "Not Nice!"

Help!?

Chris

Grinin’s picture

Anybody home? Or should we begin work on a new version of Nice Menu's ourselves?

Anonymous’s picture

I'm also getting quite some nasty feedback about users not being able to navigate our website because Nice Menus's sub-menus close too fast.

Any ideas how the code could be patched are greatly appreciated.

Or if anyone knows of an alternative module that does the same thing better... does Drupal v5 come with pop-up menus out of the box?

NealBussett’s picture

StatusFileSize
new2.16 KB

Here's a working (and tested in Safari, Firefox (Win & Ubuntu), Opera, and IE6) fix. Both files are drop-in replacements for their counterparts.

Two parts. This is the JS component.

NealBussett’s picture

StatusFileSize
new5.53 KB

Second Part: the module.

amanire’s picture

Just as an FYI, the fix that NealBussett posted crashes Drupal 5 with an undefined call to theme_add_style.

add1sun’s picture

Priority: Critical » Normal
Status: Needs work » Active

Yeah, 4.7 module code doesn't work in 5. That said new features will only go into 5 now so I'm moving this to 5 dev and we will need newer code that uses jquery.

The larger question is if we make nice menus be totally dependent on js that changes the underlying concept a bit (some people really want css only menus). There is no *general* js *dropdown* menu module for drupal yet. Simplemenu is for only one menu and it gets stuck to the top of the screen (normally intended for the main navigation menu) and DHTML menu is not for dropdown/flyout but for expand/contract.

So, if nice menus moves to js do we still support a css-only version as well for folks that still want that? Another question is, is it at all feasible to join forces with the DHTML module and create one module that lets you do multiple kinds of js menus?

Thoughts on this are welcome.

AdrianB’s picture

If it's not too much trouble I'd say keep the css-only menu and make it an option (default or not default). Right now we have a fully working css-only menu (used for standard-compliant browsers) and a fully working js menu (used for IE), so most of the work is already done as far as I can see. When I switch to the [hacked] jquery version of Nice Menus I noticed the sliding effect and I guess some people would like to add such effects (and others) to all browsers. If there was a setting for this ("always use js menu") I think that would please these people.

Jomel’s picture

Couldn't you keep a basic CSS implementation, then use JS to improve/override it if available?

AdrianB’s picture

I think there are those who prefer the css-only menu even if javascript is available.

neurojavi’s picture

Hi:

Great modelule! Thanks!

The patch form NealBussett is for 4.7 or for 5.x?
I've tested in drupal 5.1 with firefox and see no changes with the default behavior.

Can I try something to get taht delay in 5.x?

Many thanks.-

PD: I agree with previous post: Without this feature the menus are a little difficult to use.

Javi.-

add1sun’s picture

Title: Delay in show/hide for menu? » Add full javascript option
Version: 4.7.x-1.x-dev » 6.x-2.x-dev

I would guess that the patch was against 4.7 since that was the version on the issue before I just changed it. If a new feature like this goes in though, it will only go into HEAD or into a new 5.x-2 version since it is a significant new feature. We need to get a 5.x-1 stable release out the door right now. I don't have time to work on this but if anyone wants to write a patch that uses jquery and against the newer code I'll be glad to review. I would say also that pursuant to this thread it would need to be an option that folks can choose to use the css-only or full-js version on the settings page.

emdalton’s picture

My users want this as well (on Drupal 5.1). The behavior on Firefox is actually pretty good, but IE is awful. I looked at the javascript (since that's what controls IE) and then googled around for ideas on how to use jquery to do this. http://www.learningjquery.com/2007/01/effect-delay-trick suggested adding

.animate({opacity: 1.0}, 3000)

Since the opacity is already at full, apparently this just causes a delay.

I tinkered with this a bit and ended up modifying the hide line to look like this:

$(this).animate({opacity: 1.0}, 1000).find("> ul").hide().removeClass("over");

It's still a bit flaky, and sometimes there's a delay in showing a menu dropdown because it's still thinking about the previous menu choice, but it's better than it was. Someone who really understands how jquery works could probably do better, but I'll use this for now.

emdalton’s picture

I switched to Lucid Menu and my users are much happier now. Just thought I'd share that. (Nice Menus looks great in Firefox, but the IE behavior was driving people crazy.)

add1sun’s picture

Status: Active » Closed (won't fix)

yeah, I think with Lucid menu out now, if folks want a JS-only menu they should go that route. Nice menus can remain focused on CSS menus. Unfortunately the problem with JS-only is the lack of graceful degradation for folks without javascript.

I'm going to mark this won't fix unless someone really wants to figure out a "good" way to do this within nice_menus.