michaelvallotton
Junior Member
Posts: 2
Registered: 2/26/2007
Member Is Offline
|
| posted on 2/26/2007 at 04:54 AM |
|
|
Keeping mouseover effects when submenu is selected
I hope this post is ok. If it isn't, please just delete it and accept my apologies.
I wanted to keep the mouseover effect on the parent menu item when navigating to the submenu. For example, I have some grey buttons which change to
red when selected. The submenus are also red. The behavior I disliked was that when I selected an item in the submenu, the main menu item went back
to the normal grey.
I modified the menu.js script as shown below so that the mouseover effect would "stick" on the parent menu item if a submenu item is selected.
| Code: |
function menu_onmouseover (id) {
this.active_item = this.items[id];
clearTimeout(this.hide_timer);
var curr_item, visib;
for (var i = 0; i < this.items.length; i++) {
curr_item = this.items;
visib = (curr_item.arrpath.slice(0, curr_item.depth).join('_') ==
this.active_item.arrpath.slice(0, curr_item.depth).join('_'));
if (visib)
{
if(curr_item == this.active_item)
{
curr_item.switch_style('onmouseover');
}
else if(curr_item.arrpath != this.active_item.arrpath.toString().charAt(0))
{
curr_item.switch_style('onmouseout');
}
}
curr_item.visibility(visib);
}
}
|
Michael Vallotton
Co-founder JAMWare Solutions
www.jamware.net
|
|
|
tigra
Administrator
Posts: 1869
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 2/26/2007 at 04:56 AM |
|
|
As always user contributions like yours are encouraged and greatly appreciated.
|
|
|
michaelvallotton
Junior Member
Posts: 2
Registered: 2/26/2007
Member Is Offline
|
| posted on 2/26/2007 at 02:05 PM |
|
|
Ok, great. I hope someone finds this useful.
I love this menu control . . .
Michael Vallotton
JAMWare Solutions
www.jamware.net
|
|
|
satanistlav
Newbie
Posts: 1
Registered: 7/19/2007
Location: Moscow
Member Is Offline
|
| posted on 7/19/2007 at 09:33 AM |
|
|
Don't know for which version was your post but it did not work for me!
For the Version: 2.1 modification bellow worked well for me
| Code: |
function menu_onmouseout (n_id) {
// lookup new item's object
var o_item = this.a_index[n_id];
// apply rollout
// start of modification
o_activeitem = o_item;
while(o_activeitem.n_depth >=0 ){
o_activeitem.e_oelement.className = o_activeitem.getstyle(0, 0);
o_activeitem.e_ielement.className = o_activeitem.getstyle(1, 0);
o_activeitem = o_activeitem.o_parent;
}
//end of modification
// update status line
o_item.upstatus(7);
// run mouseover timer
this.o_hidetimer = setTimeout('A_MENUS['+ this.n_id +'].collapse();',
o_item.getprop('hide_delay'));
}
function menu_onmouseover (n_id) {
// cancel mouseoute menu close and item open delay
clearTimeout(this.o_hidetimer);
this.o_hidetimer = null;
clearTimeout(this.o_showtimer);
// lookup new item's object
var o_item = this.a_index[n_id];
// update status line
o_item.upstatus();
// apply rollover
// start of modified code
o_activeitem = o_item;
while(o_activeitem.n_depth >=0 ){
o_activeitem.e_oelement.className = o_activeitem.getstyle(0, 1);
o_activeitem.e_ielement.className = o_activeitem.getstyle(1, 1);
o_activeitem = o_activeitem.o_parent;
}
// end of modification
// if onclick open is set then no more actions required
if (o_item.getprop('expd_delay') < 0)
return;
// run expand timer
this.o_showtimer = setTimeout('A_MENUS['+ this.n_id +'].expand(' + n_id + ');',
o_item.getprop('expd_delay'));
}
|
|
|
|