Jump to content

Javascript menu for Wordpress help


dsp77

Recommended Posts

i have this menu item for wordpress everything works except that i want to keep the list open when a page (current page) is selected and i cannot make it, any ideas?

The menu below is what wordpress and java generates.

<script type="text/javascript">

var menuids=["menu-test"] //Enter id(s) of each Side Bar Menu's main UL, separated by commas

function initsidebarmenu(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    ultags[t].parentNode.getElementsByTagName("a")[0].className+=" subfolderstyle"
  if (ultags[t].parentNode.parentNode.id==menuids[i]) //if this is a first level submenu
   ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" //dynamically position first level submenus to be width of main menu item
  else //else if this is a sub level submenu (ul)
    ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.display="block"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.display="none"
    }
    }
  for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
  ultags[t].style.visibility="visible"
  ultags[t].style.display="none"
  }
  }
}

if (window.addEventListener)
window.addEventListener("load", initsidebarmenu, false)
else if (window.attachEvent)
window.attachEvent("onload", initsidebarmenu)

</script>
<style type="text/css">
/* MENU */
#menu-header .menu-item {
background-image:url("images/homeBg.jpg");
background-position:left top;
background-repeat:no-repeat;
/*height:26px;*/
margin:0 0 2px 10px;
padding:0;
width:160px;
}
#menu-header .menu-item a {
color:#9495A0;
display:block;
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
font-style:normal;
font-weight:bold;
height:26px;
line-height:26px;
margin:0;
padding:0;
text-decoration:none;
width:160px;
}
#menu-header ul.sub-menu {
list-style:none outside none;
margin:4px 0 4px 10px;
padding:0;
}
#menu-header ul.sub-menu li {
/*height:18px;*/
line-height:18px;
margin:0 0 2px;
padding:0;
width:160px;
}
#menu-header ul.sub-menu a {
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
font-style:normal;
font-weight:bold;
color:#6F6F6F;
text-decoration:none;
display:block;
margin:0px;
padding:0px;
width:160px;
line-height:18px;
height:18px;
padding-left:14px;
background-image:url("images/menuBg.gif");
background-repeat:no-repeat;
background-position:top left;
}
#menu-header ul.sub-menu a:hover {
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
font-style:normal;
font-weight:bold;
color:#FFFFFF;
text-decoration:none;
display:block;
margin:0px;
padding:0px;
padding-left:26px;
width:140px;
line-height:18px;
height:18px;
background-image:url("images/selectedMenuBg.gif");
background-repeat:no-repeat;
background-position:top left;
}
#menu-header ul.sub-menu li.selected {
width:160px;
line-height:18px;
height:18px;
margin:0px;
padding:0px;
margin-bottom:2px;
}
#menu-header ul.sub-menu li.selected a {
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
font-style:normal;
font-weight:bold;
color:#FFFFFF;
text-decoration:none;
display:block;
margin:0px;
padding:0px;
width:160px;
line-height:18px;
height:18px;
padding-left:14px;
background-image:url("images/selectedMenuBg.gif");
background-repeat:no-repeat;
background-position:top left;
}
</style>

<div class="menu-test-container" id="menu-header"><ul class="menu" id="menu-test"><li class="menu-item menu-item-type-post_type current-menu-item page_item page-item-2 current_page_item menu-item-7" id="menu-item-7"><a href="http://127.0.0.1/euraxess/" title="Acasa">Acasa</a></li>
<li class="menu-item menu-item-type-post_type menu-item-19" id="menu-item-19"><a href="http://127.0.0.1/euraxess/?page_id=4">Ce este EURAXESS?</a></li>
<li class="menu-item menu-item-type-post_type menu-item-18" id="menu-item-18"><a href="http://127.0.0.1/euraxess/?page_id=10" class="subfolderstyle">Servicii EURAXESS</a>
<ul class="sub-menu" style="left: 160px; visibility: visible; display: none;">
<li class="menu-item menu-item-type-post_type menu-item-26" id="menu-item-26"><a href="http://127.0.0.1/euraxess/?page_id=20">Centre de servicii</a></li>
<li class="menu-item menu-item-type-post_type menu-item-24" id="menu-item-24"><a href="http://127.0.0.1/euraxess/?page_id=22">Contact / Asistenta</a></li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-94" id="menu-item-94"><a href="http://127.0.0.1/euraxess/?page_id=27" class="subfolderstyle">Cercetatori straini</a>
<ul class="sub-menu" style="left: 160px; visibility: visible; display: none;">
<li class="menu-item menu-item-type-post_type menu-item-95" id="menu-item-95"><a href="http://127.0.0.1/euraxess/?page_id=29" class="subfolderstyle">Conditii de intrare</a>
<ul class="sub-menu" style="left: 174px; visibility: visible; display: none;">
	<li class="menu-item menu-item-type-post_type menu-item-97" id="menu-item-97"><a href="http://127.0.0.1/euraxess/?page_id=31">Viza si permis de sedere</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-96" id="menu-item-96"><a href="http://127.0.0.1/euraxess/?page_id=33">Permis de munca</a></li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-79" id="menu-item-79"><a href="http://127.0.0.1/euraxess/?page_id=35" class="subfolderstyle">Acomodare</a>
<ul class="sub-menu" style="left: 174px; visibility: visible; display: none;">
	<li class="menu-item menu-item-type-post_type menu-item-81" id="menu-item-81"><a href="http://127.0.0.1/euraxess/?page_id=37">Locuri de cazare</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-80" id="menu-item-80"><a href="http://127.0.0.1/euraxess/?page_id=39">Cursuri lingvistice</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-98" id="menu-item-98"><a href="http://127.0.0.1/euraxess/?page_id=41">Sanatate si centre medicale</a></li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-99" id="menu-item-99"><a href="http://127.0.0.1/euraxess/?page_id=43" class="subfolderstyle">Munca</a>
<ul class="sub-menu" style="left: 174px; visibility: visible; display: none;">
	<li class="menu-item menu-item-type-post_type menu-item-102" id="menu-item-102"><a href="http://127.0.0.1/euraxess/?page_id=45">Securitate sociala</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-100" id="menu-item-100"><a href="http://127.0.0.1/euraxess/?page_id=47">Impozitare</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-101" id="menu-item-101"><a href="http://127.0.0.1/euraxess/?page_id=49">Proprietate intelectuala</a></li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-88" id="menu-item-88"><a href="http://127.0.0.1/euraxess/?page_id=51" class="subfolderstyle">Cercetare</a>
<ul class="sub-menu" style="left: 174px; visibility: visible; display: none;">
	<li class="menu-item menu-item-type-post_type menu-item-89" id="menu-item-89"><a href="http://127.0.0.1/euraxess/?page_id=53">Cercetarea in Romania</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-90" id="menu-item-90"><a href="http://127.0.0.1/euraxess/?page_id=55">Invatamant superior</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-87" id="menu-item-87"><a href="http://127.0.0.1/euraxess/?page_id=57">Calificari</a></li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-93" id="menu-item-93"><a href="http://127.0.0.1/euraxess/?page_id=59" class="subfolderstyle">Viata cotidiana / de familie</a>
<ul class="sub-menu" style="left: 174px; visibility: visible; display: none;">
	<li class="menu-item menu-item-type-post_type menu-item-92" id="menu-item-92"><a href="http://127.0.0.1/euraxess/?page_id=61">Viata cotidiana</a></li>
	<li class="menu-item menu-item-type-post_type menu-item-91" id="menu-item-91"><a href="http://127.0.0.1/euraxess/?page_id=63">Ingrijirea copiilor / scoala</a></li>
</ul>
</li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-105" id="menu-item-105"><a href="http://127.0.0.1/euraxess/?page_id=65" class="subfolderstyle">Cercetatori autohtoni</a>
<ul class="sub-menu" style="left: 160px; visibility: visible; display: none;">
<li class="menu-item menu-item-type-post_type menu-item-106" id="menu-item-106"><a href="http://127.0.0.1/euraxess/?page_id=67">Burse si granturi</a></li>
<li class="menu-item menu-item-type-post_type menu-item-107" id="menu-item-107"><a href="http://127.0.0.1/euraxess/?page_id=69">Informatii practice</a></li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-108" id="menu-item-108"><a href="http://127.0.0.1/euraxess/?page_id=71" class="subfolderstyle">Finantare pentru cercetare</a>
<ul class="sub-menu" style="left: 160px; visibility: visible; display: none;">
<li class="menu-item menu-item-type-post_type menu-item-110" id="menu-item-110"><a href="http://127.0.0.1/euraxess/?page_id=73">Pentru Romania</a></li>
<li class="menu-item menu-item-type-post_type menu-item-109" id="menu-item-109"><a href="http://127.0.0.1/euraxess/?page_id=75">In Europa</a></li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-127" id="menu-item-127"><a href="http://127.0.0.1/euraxess/?page_id=116" class="subfolderstyle">Locuri de munca</a>
<ul class="sub-menu" style="left: 160px; visibility: visible; display: none;">
<li class="menu-item menu-item-type-post_type menu-item-126" id="menu-item-126"><a href="http://127.0.0.1/euraxess/?page_id=118">In Romania</a></li>
<li class="menu-item menu-item-type-post_type menu-item-125" id="menu-item-125"><a href="http://127.0.0.1/euraxess/?page_id=120">In Europa</a></li>
<li class="menu-item menu-item-type-post_type menu-item-124" id="menu-item-124"><a href="http://127.0.0.1/euraxess/?page_id=122">Editare CV / Postare joburi</a></li>
</ul>
</li>
<li class="menu-item menu-item-type-post_type menu-item-111" id="menu-item-111"><a href="http://127.0.0.1/euraxess/?page_id=77">Drepturi EURAXESS</a></li>
</ul></div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.