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
Comment #1
add1sun commentedSorry, 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.
Comment #2
johnhanley commentedThanks, 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.
Comment #3
add1sun commentedComment #4
add1sun commentedI'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
Comment #5
add1sun commentedComment #6
add1sun commentedMeh, looks like that SF patch isn't going anywhere and I'm not going to patch that myself. Closing as won't fix.
Comment #7
Sborsody commentedThe 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.
Comment #8
DERIIIFranz commentedcould someone please reupload the patch as the posted link is dead?
Comment #9
jordanmagnuson commentedI 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?
Comment #10
caspercash commentedIs this behavior going to be implemented in Nice Menus module? Thank you for a great module!
Comment #11
Jeroen94 commentedI'd like to have this feature too!
Comment #12
Bhuvana_Indukuri commentedEven I am looking for this option.
Comment #13
lanceh1412 commentedI'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!
Comment #14
mrpauldriver commentedThis is a required feature
Comment #15
sahil gupta commentedHi 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
Comment #16
sahil gupta commentedI have contributed a separate module on this requested feature : https://www.drupal.org/project/nice_menus_onclick
Comment #17
astonvictor commentedI'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