Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Javascript Navigation Menu - Coding tweak

Posted on 2011-03-08
3
Medium Priority
?
310 Views
Last Modified: 2012-05-11
I need a three level, acordion style navigation menu built.  I currently have what I would like, but in a two-level format.  Please see attached files for the coding and an image of what I am looking for.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">

<head>

<script type="text/javascript" src="LINK"></script>

<script type="text/javascript" src="LINK">

/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>


<script type="text/javascript">


ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='LINK' class='statusicon' />", "<img src='LINK' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "normal" //speed of animation: "fast", "normal", or "slow"
})

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
</script>



<style type="text/css">

.glossymenu{
background:#ee2e24;
margin: 0px 0;
padding: 0;
width: 150px; /*width of menu*/
border: 1px solid #9A9A9A;
border-bottom-width: 0;
}

.glossymenu a.menuitem{
font: bold 11px "Arial", Helvetica, sans-serif;
color:#FFFFFF;
display: block;
position: relative; /*To help in the anchoring of the ".statusicon" icon image*/
width: auto;
padding: 4px 0;
padding-left: 10px;
text-decoration: none;
}

.glossymenu a.menuitem .statusicon{ /*CSS for icon image that gets dynamically added to headers*/
position: absolute;
top: 4px;
right: 5px;
border: none;
}

.glossymenu div.submenu{ /*DIV that contains each sub menu*/
background:#FFFFFF;
color:#000000;
}

.glossymenu div.submenu ul{ /*UL of each sub menu*/
list-style-type: none;
background-color:#FFFFFF;
margin: 0;
padding: 0;
}

.glossymenu div.submenu ul li{
border-bottom: 1px solid black;
}

.glossymenu div.submenu ul li a{
display: block;
font: normal 11px "Arial", sans-serif;
color:#000000;
text-decoration: none;
padding: 2px 0;
padding-left: 10px;
}
</style>


<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:ContentType msdt:dt="string">Master Page</mso:ContentType>
<mso:MasterPageDescription msdt:dt="string"></mso:MasterPageDescription>
</mso:CustomDocumentProperties>
</xml><![endif]-->
<!--mstheme--><link rel="stylesheet" type="text/css" id="onetidThemeCSS" href="LINK"><meta name="Microsoft Theme" content="simple 1011, default">
</head>

<body topmargin="0" leftmargin="0">
<table border="0" height="">
<tr>
<td valign="top" background="LINK" height="">
<span class="ms-menutoolbar">
<div class="glossymenu" ><a class="menuitem" href="LINK" target="body">Home</a>
<a class="menuitem submenuheader" href="" target="body" >BLANK</a>
<div class="submenu" style="color:#000000">
	<ul class="glossymenu">
	<li><a href="LINK" target="_top">BLANK</a></li>
	<li><a href="LINK" target="_top">BLANK</a></li>
	
	<li><a href="LINK" target="_top">BLANK</a></li>
	<li><a href="LINK" target="_top">BLANK</a></li>
	<li><a href="LINK" target="_top">BLANK</a></li>
	<li><a href="LINK" target="_top">BLANK</a> </li>
	<li><a href="LINK" target="_top">BLANK</a></li>
	</ul>
</div>
<a class="menuitem submenuheader" href="#" >BLANK</a>
<div class="submenu">
  <ul class="glossymenu">
	<li><a href="LINK" target="_top">BLANK</a></li>
  </ul>
</div>
<a class="menuitem submenuheader" href="#">BLANK</a>
<div class="submenu">
	<ul class="glossymenu">
	<li><a href="LINK" target="_top">BLANK</a></li>
	
	<li><a href="LINK" target="_top">BLANK</a></li>
	<li><a href="LINK" target="_top">BLANK</a></li>
	<li><a href="LINK" target="_top">BLANK</a> </li>
	</ul>
</div>
<a class="menuitem submenuheader" href="#" >BLANK</a>
<div class="submenu">
	<ul class="glossymenu">
    <li><a href="LINK" target="_top">BLANK</a></li>
	<li><a href="LINK" target="_top" >BLANK</a></li>
	<li><a href="LINK" target="_top">BLANK</a></li>
	<li><a href="LINK" target="_top">BLANK</a><a href="LINK" target="_top"></a></li>
	</ul>
</div>
	
  


</html>

Open in new window

Nav-Menu-Example.JPG
0
Comment
Question by:ejochum
  • 2
3 Comments
 
LVL 4

Expert Comment

by:WhiteSeed
ID: 35069131
hello, I used this example to create what you are looking for on site:
http://www.scriptiny.com/2008/11/drop-down-menu/
0
 

Author Comment

by:ejochum
ID: 35069171
WhiteSeed,

I'm not sure how to "initialize" the script.  Can you attach a notepad document with that script?

Thanks
0
 
LVL 4

Accepted Solution

by:
WhiteSeed earned 2000 total points
ID: 35069494
here you can download the full source file whit the example:
http://forum.leigeber.com/index.php?app=downloads&module=display&section=download&do=confirm_download&id=7

Open in new window


to initialize use:
var menu=new menu.dd('menu');

Open in new window

where 'menu'  is the name of the object and
menu.init('menu');

Open in new window

where 'menu' the id of the menu unordered list

I'm in a hurry and can not make a more detailed example if you need i will come back in a few hours
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
This article discusses how to implement server side field validation and display customized error messages to the client.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question