Board Logo

How can a selected menu item stay in "hover" until another is selected??
spw - 1/19/2006 at 01:02 PM

In order to show "context" I want to have a selected menu item retain its "hover" state until another item is selected. Has anyone tried and had any luck implementing this? Level zero (ie: top level) menu items only is ok


tigra - 1/21/2006 at 04:11 PM

http://www.softcomplex.com/forum/viewthread_1512/


spw - 2/15/2006 at 01:08 PM

I have read the thread a few times and looked at the zipped examples - still cannot get my version (based on method two) to work in any browser.

I am sure it is something small like another missing character somewhere. The code follows - please let me know where i have made a mistake....

menu_items.js
--------------------
/* Tigra Menu items structure */

var MENU_ITEMS = [
[wrap('History'), 'history.htm', {'tw':'mainFrame'}],
[wrap('Latest News'), 'lnews.htm', {'tw':'mainFrame'}],
[wrap('Interviews'), 'interviews.htm', {'tw':'mainFrame'}],
/*
['Sound Bites', 'sounds.htm', {'tw':'mainFrame'}],
['Press', 'pressart.htm', {'tw':'mainFrame'}],
*/
[wrap('Testimonials'), 'testim.htm', {'tw':'mainFrame'}],
[wrap('Famous Friends'), 'ffriends.htm', {'tw':'mainFrame'}],
[wrap('FAQ'), 'faq.htm', {'tw':'mainFrame'}],
[wrap('Contact Mark'), 'contact.htm', {'tw':'mainFrame'}]
];


function wrap(caption) {
if (caption == CURRENT_ITEM){
alert (caption); //comes up correctly but the next line does not do anything
return '<font color="red">' + caption + '</font>';
}
else
return '<font color="white">' + caption + '</font>';
}


topfrm.htm
---------------
<html>
<head>

<script language="JavaScript">
var CURRENT_ITEM = '';
</script>


<script language="JavaScript" src="menu_files/menu.js"></script>
<script language="JavaScript" src="menu_files/menu_items.js"></script>
<script language="JavaScript" src="menu_files/menu_tpl-ns.js"></script>
<link rel="stylesheet" href="menu_files/menu.css">

</head>

<body background="images/retroflowersx.jpg">

<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100">&nbsp;</td>
<td align="center">
<h3><font face="Comic Sans MS">The Mark Copolov Radio Interviews</font></h3>
<font face="Comic Sans MS" size="2">Chronicals of a passionate musician</font> </td>
</tr>
</table>
<table width=100% border="0" cellspacing="0" cellpadding="0" >
<tr bgcolor="#3C76B2">
<td height="30">&nbsp;</td>
</tr>
</table>
<script language="JavaScript">
new menu (MENU_ITEMS, MENU_TPL);
</script>

</body>
</html>


contact.htm
----------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="JavaScript">
var CURRENT_ITEM = 'Contact Mark';
</script>

<script language="JavaScript" src="menu_files/menu.js"></script>
<script language="JavaScript" src="menu_files/menu_items.js"></script>
<script language="JavaScript" src="menu_files/menu_tpl-ie.js"></script>
<link rel="stylesheet" href="menu_files/menu.css">

</head>

<body background="images/retroflowers.jpg">
<p>&nbsp;</p>
<table width="750" border="0" cellspacing="0" cellpadding="0" height="97">
<tr>
<td width="100">&nbsp;</td>
<td width="*">
<p align="center">Mark can be contacted by <a

href="mailto:&#032;&#109;&#099;&#111;&#112;&#111;&#108;&#111;&#118;&#064;&#111;&#112;&#116;&# 117;&#115;&#110;

&#101;&#116;&#046;&#099;&#111;&#109;&#046;&#097;&#117;">e-mail</a>.</p>
<p>&nbsp;</p>
<p align="center"><img src="images/siteby.gif" usemap="#Map" border="0"></p>
</td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="0,0,134,40" href="#" target="_blank">
</map>

</body>
</html>


tigra - 2/16/2006 at 02:48 AM

If you need someone to look at your code attach complete working sample in the zip package. It takes too much time too rebuild the situation and in some cases the result may be different.


spw - 2/16/2006 at 01:37 PM

Attached is the code that reproduces the problem.

By the way, I noticed that the version of the menu.js in the example that can be downloaded is not the same version as the one I have in Menu Gold. In fact the menu.css is also different.

I need something that will work using the current version of Menu Pro (3.0) and Menu Gold (2.6) which I purchased alond with the package of other Tigra products.


tigra - 2/16/2006 at 08:27 PM

I've removed the attachment because it contained commercial code.

Anyway the problem is that you set the CURRENT_ITEM variable in the documents that don't even have the menu in them. Yes, you link the menu files but you never initialize the menu there. Anyway this feature will only work if you actually reload the document containing the menu so it will not handle the scenario with the menu in one frame and content pages in another. That's unless you reload menu frame each time which further reduces questionable advantages of frames.


spw - 2/17/2006 at 01:29 AM

Thanks for thinking about commercial code protection.

I understand - so the colouring of the menu item is done when the mainframe page is loaded - I will try the following:

Move the menu so that it overlaps the top and main fames so that the menu has to be part of the main frame pages anyway (instead of just the top frame) and thus force the evaluation of the CURRENT_ITM content when the page is loaded.

I am glad that this time it was not a bit of careless coding on my part... :)


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/