Thanks to Nice Menus we have the navigation looking and behaving perfectly, but now the client wants the navigation behavior changed so that the child menu doesn't appear until the parent menu is clicked (instead of hover.)

I've seen references in the past that this can be accomplished with JavaScript (i.e. jQuery), but wasn't able to locate anything specific.

Does anyone have any advice? Is there a snippet of Javascript that can override the default hover behavior?

Naturally all of this is last minute and needs to be completed by the end of a holiday week. :-(

Comments

add1sun’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry, I am not that familiar with it but if you searched for jQuery onclick you would probably find the function you need. You can then add your own JS to your theme to apply the jQuery.

johnhanley’s picture

Thanks, but I opted to go with Dynamic Persistent Menu, which is jQuery-driven. I simply changed the default hover method to click.

I'll leave this issue open in case someone else would like to explore adding onclick to Nice Menus.

add1sun’s picture

Status: Postponed (maintainer needs more info) » Active
add1sun’s picture

Status: Active » Postponed

I'm leaving a link to a solution here. Since NM is moving to Superfish, this SF patch does the trick. Hopefully it will go in and then it will be a configurable option. Marking this issue postponed for the time being.

http://plugins.jquery.com/node/3967

add1sun’s picture

Version: 6.x-1.3 » 6.x-2.x-dev
add1sun’s picture

Status: Postponed » Closed (won't fix)

Meh, looks like that SF patch isn't going anywhere and I'm not going to patch that myself. Closing as won't fix.

Sborsody’s picture

The link (http://plugins.jquery.com/node/3967) goes to 404.

I implemented something like this using jQuery: http://www.sohtanaka.com/web-design/easy-toggle-jquery-tutorial/

It seems like it might be trivial for Nice Menus to add something like that for devices that don't support hover (ie., iPhone/iPad). Nice Menus already does some minimal JavaScript for IE6.

DERIIIFranz’s picture

could someone please reupload the patch as the posted link is dead?

jordanmagnuson’s picture

Title: change behavior from hover to onclick w/ JavaScript » Support onclick dropdown behavior
Version: 6.x-2.x-dev » 7.x-2.x-dev
Component: Miscellaneous » Code
Status: Closed (won't fix) » Active

I know this is an old issue, but since I can't find any info on this elsewhere, are there any plans yet to support "onclick" dropdown behavior in Nice Menus? I'd love to be able to create on click Facebook-style dropdown menus regardless of device (eg like this)...

Of course, if this is still a no-go, feel free to re-close.

On a related note, does anyone know of a Drupal module that currently supports this?

caspercash’s picture

Is this behavior going to be implemented in Nice Menus module? Thank you for a great module!

Jeroen94’s picture

Issue summary: View changes

I'd like to have this feature too!

Bhuvana_Indukuri’s picture

Even I am looking for this option.

lanceh1412’s picture

I've just run into this problem. I was also looking at tb_megamenu which seems to work fine with a touch screen (although I have only tested it out using chrome dev tools). I chose nice_menus initially because it was easy to theme but will look again at tb_megamenu and see if I can work out how to theme it!

mrpauldriver’s picture

This is a required feature

sahil gupta’s picture

Hi Everyone,

I have written the full solution for this in here :

Nice Menu OnClick Support

I have also created a small module, you can download it and enable the module but you have to do step 3 and 4 manually. If you follow all the steps, you will be able to have onclick support for nice menus.
Unfortunately i don't have enough time to create a whole generalize module and post it on drupal community but this whole solution can take the form a full module if anyone willing to write a additional feature for this function.

Thanks

sahil gupta’s picture

I have contributed a separate module on this requested feature : https://www.drupal.org/project/nice_menus_onclick

astonvictor’s picture

Status: Active » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks