How much effort would be involved in changing the hover behavior to onclick?

Comments

johnhanley’s picture

Status: Active » Closed (fixed)

Shame on me for not looking at dynamic_persistent_menu.js prior to asking!

To change the navigation behavior from hover to onclick, simply change the method on line 8 from "mouseover" to "click" like so

$(".dynamic-persistent-menu-menu-item").click(

Perhaps a nice feature would be to add this as a configurable option.

Sinan Erdem’s picture

Status: Closed (fixed) » Active

Hi...

Sorry for reopening such an old issue but... I want the sub-menu close if a user clicks on the parent menu item again. I mean a click will toggle the visibility of the sub-menu. Can you think of any solutions to this?

Also I want the sub-menu stay opened. I changed the "Sub-menu timeout" to a very large number. It works, but is it a good solution in terms of performance or something??

Thanks already...

jenlampton’s picture

I would also like the ability to choose between a hover-driven or click-driven display change for the sub-menus. This is particularly useful if you are looking for a drop-down menu that will work on tablets, or touch-devices that do not have a hover state.

I ended up also making the same hack as in #1.

In addition, we did not want the child-menu to display automatically for any given section - we wanted the sub-menus to *only* be visible when the parent link was clicked, so we also changed line 120 of the .module file to always, always hide the child menu, as follows:

$submenu .= '<ul class="dynamic-persistent-menu-sub-menu" id="dynamic-persistent-menu-sub-menu'. $link['mlid'] .'" style="display:none">';

And then in the .js file I had to change dynamic_persistent_menu_reset function NOT to show the sub-menu.

But, that is a whole other issue. Please see #1211764: Provide different options for how the sub-menus are displayed