I would like my parent menu to expand on mouseover instead of on click. I've searched through the code, but apparently overlooked it. Where should I start looking for this code?

Connie

Comments

cburschka’s picture

Component: PHP Code » Javascript code
Status: Active » Closed (fixed)

In the JS file, search for the places where click(function()) is called, and replace "click" with "hover".

conniec’s picture

Thank! Just what I needed

Connie

Mark B’s picture

Er - almost...
The jQuery click function takes a single argument (the function to execute when clicked), while the hover function takes two (the function to execute when hovering, and the function to execute when you move off the element).

I tried simply changing the .click to a .hover, and it worked great for my first expanding menu item, but the second wouldn't expand.

Try adding a second empty function argument to the click command - change

$(li).find('a:first').click(function(e) {
  Drupal.dhtmlMenu.toggleMenu($(li));
  return false;
});

to

$(li).find('a:first').hover(
  function(e) {
    Drupal.dhtmlMenu.toggleMenu($(li));
    return false;
  },
  function() {}
);
pipicom’s picture

Thanks Mark B, it worked!

Holoduke’s picture

I coded some thing similar. I will keep this request closed but I will add my version... perhaps somebody find this helpful.

It adds a small delay.

Look up:

if (effects.doubleclick) {
$(li).find('a:first').dblclick(function(e) {
window.location = this.href;
});
}

$(li).find('a:first').click(function(e) {
Drupal.dhtmlMenu.toggleMenu($(li));
return false;
});

And change it to:

$(li).find('a:first').click(function(e) {
window.location = this.href;
});

$(li).find('a:first').hover(
function() {
mili=$(li);
contaJ=setTimeout(function(){
Drupal.dhtmlMenu.toggleMenu($(li));
},"500");
return false;
},
function() {
clearTimeout(contaJ);
return false;
});

texas-bronius’s picture

Thanks Holoduke. Worked for me like a charm.