Closed (fixed)
Project:
DHTML Menu
Version:
6.x-3.4
Component:
Javascript code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Mar 2009 at 13:58 UTC
Updated:
2 Sep 2010 at 03:30 UTC
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
Comment #1
cburschkaIn the JS file, search for the places where click(function()) is called, and replace "click" with "hover".
Comment #2
conniec commentedThank! Just what I needed
Connie
Comment #3
Mark B commentedEr - 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
to
Comment #4
pipicom commentedThanks Mark B, it worked!
Comment #5
Holoduke commentedI 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;
});
Comment #6
texas-bronius commentedThanks Holoduke. Worked for me like a charm.