JavaScript - Recreate A Menu Like This One
http://www.olive-catering.com/whoforie.html
Ive been asked if i could create a menu like that, i know that's flash but id rather do it in javascript if possible. How would i roughly do it? Similar TutorialsHi Exprts, I am using a (anylink)javascript menu from dynamic drive. Basically I am having a design issue but posting the problem here because I think this can be fixed through JS. Please download the attached files. You will see the menu & the sub menu on mouse over. Problem is that.... when the submenu appears & I take my mouse to the sub menu, the parent item hover style disappears. I mean, it doesn't look active. I just want the parent item active when users moves his/her mouse to sub menu. Thats all. Please suggest me any solutions for this. Thank you in advance. Hi all, this is my first post so forgive me for any errors but i'll try and give all the information i can. i use Xara Designer Pro and i have used a 3rd party software to create a html menu however i have a html loading screen on my site and the menu always appears on top of the screen and while the screen is loading, this is the only thing that appears on top everything else is fine, i have put this to the people on the xara forums and the opinion is that its probably the JS file that the menu is using that is telling it to appear on top. i was wondering what i should look for to determin this problem or if someone could take a look at it for me? i'll upload the JS here and see if anyone can help. my site is at www.pcevo.co.uk however you need to CTRL + F5 to refresh wihtout the cache to see the loading screen if you are on a fast connection.
I'm creating a menu using html, css and a javascript, I found a tutorial to follow online. What I am trying to achieve is when the mouse hovers over the menu items, each item will have a different colour background. the problem is that i can do this but it only works with one colour and not different colours. this is the html: Code: <ul> <li><a href="1.php">Things</a></li> <li><a href="2.php">Animals</a> <ul> <li><a href="2-1.php">Cani</a> <ul> <li><a href="2-1-1.php">Domestic dogs</a></li> <li><a href="2-1-2.php">Wolves</a></li> </ul> </li> <li><a href="2-2.php">Felidae</a> <ul> <li><a href="2-2-1.php">Domestic cats</a></li> <li><a href="2-2-2.php">Wild cats</a></li> </ul> </li> </ul> </li> <li><a href="3.php">Humans</a></li> </ul> the css is as follows: Code: div#s1 { width: 200px; /* menu width */ } div#s1 ul { background-color: #036; list-style-type: none; /* get rid of the bullets */ padding:0; /* no padding */ margin:0; /* no margin for IE either */ } div#s1 ul li { margin: 0; padding: 0; background-color: #036; display:block; border-top: 1px solid white; /* lines */ } div#s1 ul li a { display: block; /* lines extend to right, make area clickable */ color: white; background-color: #036; padding: 3px 3px 3px 23px; margin:0; text-decoration: none; height:15px; /* hint for IE, alternatively remove whitespace from HTML */ } div#s1 ul ul li a { margin-left: 20px; /* indent level 1 */ } div#s1 ul ul ul li a { margin-left: 40px; /* indent level 2 */ } div#s1 ul ul ul ul li a { margin-left: 60px; /* indent level 3 */ } div#s1 li ul, div#s1 li.open li.closed ul { display: none; /* collapse */ } div#s1 li.open ul { display: block; /* expand */ } div#s1 ul li.open a { background-image: url(bullet_open.gif); background-repeat: no-repeat; } div#s1 ul li.closed a { background-image: url(bullet_closed.gif); background-repeat: no-repeat; } div#s1 ul li.leaf a { background-image: url(bullet_leaf.gif); background-repeat: no-repeat; } div#s1 li.active a { background-position: 0px -20px; color: red; /* highlight text */ } div#s1 li.active li a { background-position: 0px 0px; color: white; /* fix lower levels */ } div#s1 ul li a:hover { color: red; background-color: #06C; /* rollover effect */ } and finally the javascript: Code: var menu_active_class = "active"; var menu_leaf_class = "leaf"; var menu_open_class = "open"; var menu_closed_class = "closed"; //the default page that is displayed if URL ends in / var menu_default_page = "index.php"; var menu_url; //main function //menu_id : id of the element containing the navigation function menu_main(menu_id) { var url = location.href; if (url.lastIndexOf("/") == (url.length-1)) { url = url+menu_default_page; } if (url.lastIndexOf("?") >= 0) { url = url.substring(0, url.lastIndexOf("?")); } if (url.lastIndexOf("#") >= 0) { url = url.substring(0, url.lastIndexOf("#")); } menu_url = url; var main = document.getElementById(menu_id); if (!main) alert("No element with id '"+ menu_id +"' found"); menu_traverse(main); } /* Walks down the subtree and on the way back sets properties. returns bit set 1: set = element is a node, unset = element is a leaf 2: set = element contains the active node 4: set = element is the active A node */ function menu_traverse(element) { var props = 0; // walk down for (var i=0; i<element.childNodes.length; i++) { var child = element.childNodes[i]; props |= menu_traverse(child); // aggregate bits } // on the way back now switch (element.tagName) { case "UL": props |= 1; break; case "LI": var c1 = (props & 1) ? ((props & (2|4)) ? menu_open_class : menu_closed_class) : menu_leaf_class; element.className = element.className ? element.className+" "+c1 : c1; if (props & 4) { if (!(props & 2)) element.className += " "+menu_active_class; props |= 2; props &= 1 | 2; // reset bit 4 } break; case "A": if (props & 2) break; // once is enough var href = element.getAttribute("href"); if (menu_isSameUrl(menu_url, href)) props |= 4; break; } return props; } //matches two URIs when href is the last part of url //.. and . are correctly resolved function menu_isSameUrl(url, href) { var a = url.split(/[?\/]/i); var b = href.split(/[?\/]/i); var i = a.length - 1; var j = b.length - 1; while ((i >= 0) && (j >= 0)) { if (b[j] == "..") { j-=2; continue; } if (a[i] == "..") { i-=2; continue; } if ((b[j] == ".") || (b[j] == "")) { j--; continue; } if ((a[i] == ".") || (a[i] == "")) { i--; continue; } if (! (a[i] == b[j])) return false; i--; j--; } return true; } New to this forum but hope this will explain my problem, any help is much appreciated! thanks!! Jesper I am having trouble with a sub-menu of the 1st item only and can not seem to figure it out. All the others are fine. Any help is appreciated. Here is the code: var NoOffFirstLineMenus=7; // Number of first level items var LowBgColor='white'; // Background color when mouse is not over var LowSubBgColor='white'; // Background color when mouse is not over on subs var HighBgColor='black'; // Background color when mouse is over var HighSubBgColor='black'; // Background color when mouse is over on subs var FontLowColor='black'; // Font color when mouse is not over var FontSubLowColor='black'; // Font color subs when mouse is not over var FontHighColor='white'; // Font color when mouse is over var FontSubHighColor='white'; // Font color subs when mouse is over var BorderColor='black'; // Border color var BorderSubColor='black'; // Border color for subs var BorderWidth=1; // Border width var BorderBtwnElmnts=1; // Border between elements 1 or 0 var FontFamily="arial,comic sans ms,technical" // Font family menu items var FontSize=9; // Font size menu items var FontBold=1; // Bold menu items 1 or 0 var FontItalic=0; // Italic menu items 1 or 0 var MenuTextCentered='center'; // Item text position 'left', 'center' or 'right' var MenuCentered='center'; // Menu horizontal position 'left', 'center' or 'right' var MenuVerticalCentered='top'; // Menu vertical position 'top', 'middle','bottom' or static var ChildOverlap=.2; // horizontal overlap child/ parent var ChildVerticalOverlap=.2; // vertical overlap child/ parent var StartTop=05; // Menu offset x coordinate var StartLeft=05; // Menu offset y coordinate var VerCorrect=0; // Multiple frames y correction var HorCorrect=0; // Multiple frames x correction var LeftPaddng=3; // Left padding var TopPaddng=2; // Top padding var FirstLineHorizontal=1; // SET TO 1 FOR HORIZONTAL MENU, 0 FOR VERTICAL var MenuFramesVertical=1; // Frames in cols or rows 1 or 0 var DissapearDelay=1000; // delay before menu folds in var TakeOverBgColor=1; // Menu frame takes over background color subitem frame var FirstLineFrame='navig'; // Frame where first level appears var SecLineFrame='space'; // Frame where sub levels appear var DocTargetFrame='space'; // Frame where target documents appear var TargetLoc=''; // span id for relative positioning var HideTop=0; // Hide first level when loading new document 1 or 0 var MenuWrap=1; // enables/ disables menu wrap 1 or 0 var RightToLeft=0; // enables/ disables right to left unfold 1 or 0 var UnfoldsOnClick=0; // Level 1 unfolds onclick/ onmouseover var WebMasterCheck=0; // menu tree checking on or off 1 or 0 var ShowArrow=1; // Uses arrow gifs when 1 var KeepHilite=1; // Keep selected path highligthed var Arrws=['tri.gif',5,10,'tridown.gif',10,5,'trileft.gif',5,10]; // Arrow source, width and height function BeforeStart(){return} function AfterBuild(){return} function BeforeFirstOpen(){return} function AfterCloseAll(){return} // Menu tree // MenuX=new Array(Text to show, Link, background image (optional), number of sub elements, height, width); // For rollover images set "Text to show" to: "rollover:Image1.jpg:Image2.jpg" Menu1=new Array("Home","","",3); Menu1_1=new Array("The Ayllu","The Ayllu.htm","",0,20,150); Menu1_2=new Array("Acknow","Acknowledgement.htm","",0); Menu1_3=new Array("Prayer","Prayer.htm","",0); Menu2=new Array("About Us","","",4); Menu2_1=new Array("Debra","bio.htm","",0,20,150); Menu2_2=new Array("Seamus","Seamus.htm","",0); Menu2_3=new Array("Locations","location.htm","",0); Menu2_4=new Array("Contact Us","contact.htm","",0); Menu3=new Array("Services","","",7); Menu3_1=new Array("Shamanic Healing","http://www.Ayllu.us/Shamanic Healing.htm","",0,20,150); Menu3_2=new Array("Shamanic Counseling","http://www.Ayllu.us/Shamanic Counseling.htm","",0); Menu3_3=new Array("Sacred Ceremonies","http://www.Ayllu.us/Sacred Ceremonies.htm","",0); Menu3_4=new Array("Sacred Body Work","http://www.Ayllu.us/sbw.htm","",0); Menu3_5=new Array("Full Moon Crystal Bowl","http://www.Ayllu.us/fm.htm","",0); Menu3_6=new Array("Sound Healing","http://www.Ayllu.us/Sound Healing.htm","",0); Menu3_7=new Array("LaHo-Chi","http://www.Ayllu.us/lahochi.htm","",0); Menu4=new Array("Calendar","http://www.ayllu.us/calendar.htm","",0); Menu5=new Array("Gallery","http://www.ayllu.us/gallery.html","",0); Menu6=new Array("Articles","","",3); Menu6_1=new Array("Test 1","http://www.Ayllu.us/blank.htm","",0,20,150); Menu6_2=new Array("Test 2","http://www.Ayllu.us/blank.htm","",0); Menu6_3=new Array("Test 3","http://www.Ayllu.us/blank.htm","",0); Menu7=new Array("Links","http://www.ayllu.us/links.htm","",0); ? how would i make it for a menu so you could press it and it would go down to click on a link.
Hello all, I am currently looking to create a JavaScript menu for a website I am working on. It currently expands and collapses on click. The code in question is pasted below:- menu_status = new Array(); function showHide(theid){ if (document.getElementById) { var switch_id = document.getElementById(theid); if(menu_status[theid] != 'show') { switch_id.className = 'show'; menu_status[theid] = 'show'; }else{ switch_id.className = 'hide'; menu_status[theid] = 'hide'; } } } As you can see, it basically shows and hides the menu (when clicked). I want it to open the menu when clicked and close when another menu is opened. I have looked and have not been able to find a solution into it. Ideally I donot want it to be a long piece of code as I do have a working menu but with many more lines of JavaScript than the one I have posted. I need a solution to it urgently, your help is appreciated. Thanks Hi there, I am trying to create "sideways" sub menus off of my main vertical menu images. (Something like this example: http://netweblogic.com/demos/ddm/vddm-nomoo.htm but in the place of Menu Item 1, Menu Item 2, Menu Item 3 there would be roll over images.) The main vertical menu items I have are rollover images. I would like the sub menu to appear when you hover over the main menu item. When I attempt this using the above example, all of my other CSS and JS does not work. Any help on how to link my rollover menu images to the sub menu would be greatly appreciated! Thanks in advance! Here is the code for my menu (I have only included 2 menu items here, if you need more info please let me know): Code: <script type="text/javascript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> </head> <body onload="MM_preloadImages('images/buttons/teamandcorpsports.jpg','images/buttons/performancesports.jpg','images/buttons/flagsandbanners.jpg','images/buttons/home.jpg','images/buttons/catalogues.jpg','images/buttons/galleries.jpg','images/buttons/designown.jpg','images/buttons/dealerlogin.jpg','images/buttons/contactus.jpg','images/buttons/dealersignup.jpg')"> <div id="wrapper"> <div id="header"> <h1> </h1> </div> <!-- Main content --> <div id="content"> <div style="text-align:center"> <img id="pic" src="images/slideshow/slideshow1.jpg" width="600" height="600" alt="slideshow" /> </div> <script type="text/javascript" src="slideshow.js"></script> </div> <!-- Site navigation menu --> <div id="navcontainer"> <ul> <li><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('teamandcorpsports1','','images/buttons/teamandcorpsports.jpg',1)"><img src="images/buttons/teamandcorpsports1.jpg" alt="Team and Corporate Sports" name="teamandcorpsports1" width="224" height="37" border="0" id="teamandcorpsports1" /></a></li> <li><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('performancesports1','','images/buttons/performancesports.jpg',1)"><img src="images/buttons/performancesports1.jpg" alt="Performance Sports" name="performancesports1" width="224" height="37" border="0" id="performancesports1" /></a></li> Here is my CSS code for the menu, not sure if this is where the issue is? Code: /* navigation menu */ #navcontainer ul { margin: 0; padding: 0; list-style-type: none; /* removes bullets */ background-image:url('background.jpg'); } #navcontainer li { margin: 0 0 0 0; /* separates list items */ } #navcontainer a { display: block; /* achieves rollover */ width: 250px; /* list width */ text-decoration: none; } I know how to edit the CSS, and minute parts of the JavaScript code (for example; speed of the drop). The problem is, I had a massive amount of help making the Javascript side of the menu, and do not know how to edit it... I want the rules to still apply, where only one can be expanded at a time (one of the first drops, and then only one of the sub-drops). I noticed in the code, I can edit it so there can be more than one drop, but that would mean, the whole menu could be expanded Also, I want my sub-drops. to have different span colour than the main drop. but trhe links and such, (everything else about it) can be the same.... My live demo is here! Thank you for any help and/or advice in advance, Best Regards, Tim Hello, I posted a question on here last week about using two independent yet identical javascript menus, visible he http://rebeccabersohn.com/ They are working perfectly in Firefox, but seem to be having some problems in Safari. Occasionally they work, however after a reload they seem to get "stuck". I have not been able to test the page on any other browsers, but of course it would be ideal if it could work everywhere (even ie6!!) I'm new to javascript and am unable to locate my problem. Thank you! Hi! I'm relatively new to JavaScript, though I've done some PHP and Java programming before. Still, be gentle . I have a menu with some images as the links. These images have onmouseover() and onmouseout() functions where the image is changed (onmouseover makes the image blue, while the onmouseout restores the original white). Now, my problem is that I also want to make the link corresponding to the currently open page to stay blue all the time, but I cannot for the life of me figure out how to do it. I've tried with onClick="document.[IMG].src='blue'" but clearly, as the page reloads to open the chosen link, the image is reset to white. I've also tried some other, unsuccessful solutions that don't need mentioning here... How do I make the image stay blue even when the page is reloaded? I'd be really happy if you could point me towards some examples of this being done. This is parts of my code (it's not much and I know it's a bit of a mess, it's in the developmental stages...): Code: function printHTMLTop() { var html = '<div class="main" id="main"> \ <div class="header" id="header">\ <div class="topHeader" name="topHeader"> \ <div class="logo" name="logo"><a href="index.php"><img src="logoBlue02.png" /></a></div> \ \ </div> \ <div class="midHeader" name="midHeader"><img src="midHeadImg.png" /></div> \ <div class="bottomHeader" name="bottomHeader"> \ <div class="menu" name="menu"><a href="index.php"><img name="hem" id="hem" src="menu_HemW.png" onmouseover="document.hem.src=\'menu_HemB.png\'" onmouseout="document.hem.src=\'menu_HemW.png\'" /></a></div> \ <div class="menu" name="menu"><a href="Contract.php"><img name="skapa" src="menu_SkapakontraktW.png" onmouseover="document.skapa.src=\'menu_SkapakontraktB.png\'" onmouseout="document.skapa.src=\'menu_SkapakontraktW.png\'" /></a></div> \ <div class="menu" name="menu"><a href="gbookAdd.php"><img name="gbook" src="menu_GbookW.png" onmouseover="document.gbook.src=\'menu_GbookB.png\'" onmouseout="document.gbook.src=\'menu_GbookW.png\'" /></a></div> \ <div class="menu" name="menu"><a href="Forskning.html"><img name="forskning" src="menu_ForskningW.png" onmouseover="document.forskning.src=\'menu_ForskningB.png\'" onmouseout="document.forskning.src=\'menu_ForskningW.png\'" /></a></div> \ <div class="menu" name="menu"><a href="Intervjuer.html"><img name="intervju" src="menu_IntervjuerW.png" onmouseover="document.intervju.src=\'menu_IntervjuerB.png\'" onmouseout="document.intervju.src=\'menu_IntervjuerW.png\'" /></a></div> \ <div class="menu" name="menu"><a href="Ungdom.html"><img name="ungdom" src="menu_UngdomW.png" onmouseover="document.ungdom.src=\'menu_UngdomB.png\'" onmouseout="document.ungdom.src=\'menu_UngdomW.png\'" /></a></div> \ <div class="menu" name="menu"><a href="Lankar.html"><img name="lank" src="menu_LankarW.png" onmouseover="this.src=\'menu_LankarB.png\'" onmouseout="this.src=\'menu_LankarW.png\'" /></a></div> \ </div> \ </div> \ <div class="mid" id="mid">'; document.write(html); } Thanks for your help! Hi, I have an animated banner on my homepage. I have a CSS menu. The CSS menu is appearing behind the JS banner. Only in one version of IE8 (8.0.6001.18702). Other version of IE 8, it works fine. I have set all the Z-index values in the CSS. I was wondering if you could add anything in the JS. Like for SWF you can set <param name="wmode" value="transparent">. The site is http://capitalshores.com/ I am using this slideshow: http://www.dynamicdrive.com/dynamici...nslideshow.htm Thanks, Ryan I'm trying to learn to write javascript myself. So please, don't right anything for me, just steer me in the right direction. The way I have my my navigation set up is when the user clicks on a section of the main nav, the subnav displays beneath the header (see the pic more a visual idea). I want the the subnav for "Services" to be displayed on all pages that are listed under Services. Same thing for everything else on the nav bar. They way it's set up right now, the "about" submenu is displayed on every page. If the user clicks on "services" then that submenu displays. Just in case you need it, I'm posting the code for that. Like I said above, please don't write anything for me, just point me in the right direction. Code: /*Javascript to display Sub Menu */ function showAbout() { if(subnav.style.display=="none") { subnav.style.display="block"; services.style.display="none"; contact.style.display="none";; partners.style.display="none"; } else subnav.style.display="none"; } function showServices() { if(services.style.display=="none"){ services.style.display="block"; subnav.style.display="none"; contact.style.display="none"; partners.style.display="none"; } else services.style.display="none"; } function showContact() { if(contact.style.display=="none"){ contact.style.display="block"; subnav.style.display="none"; services.style.display="none"; partners.style.display="none" } else contact.style.display="none"; } function showPartners() { if(partners.style.display=="none"){ partners.style.display="block"; subnav.style.display="none"; services.style.display="none"; contact.style.display="none"; } else partners.style.display="none"; } Having trouble with Nested Side Bar menu. I got the coding reference from here and tried to alter it for my profile. http://www.dynamicdrive.com/style/cs...side_bar_menu/ I know there are easier ways to create menus like this with flash, but Im trying to learn with CSS,HTML, JAVASCRIPT.If there is anyone that can help me find an easier solution in how to do menus i would like to take your advice, Basically I wanted to change the image on the button that receives the mouse-over. Then, when i place my mouse over the second button just sits idle with no sub-menu employed. Only the first button receives the commands to employ the sub-menu. This is my Code. ********************************************************** <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" type="text/css" href="4thcss.css"> <script src="4thport.js" type="text/javascript"> </script> <title>Ruddy's Portfolio</title> </head> <body> <div id="container"> <div id="containerbackground"> </div> <div id="header"> </div> <div id="headertitles"> <a href="https://www.google.com">CSS</a> <a href="https://www.google.com">PHP</a> <a href="https://www.google.com">HTML</a> <a href="https://www.google.com">JAVASCRIPT</a> <a href="https://www.google.com">MySQL</a> </div> <div id="content"> <p>Hello, this is my website page!<br> Everything done here is by my <br>creative influence.<br> I Hope that you enjoy!</p> </div> ********************************************************** ********************************************************** <div id="yellowbutton"> <div class="sidebarmenu"> <ul id="sidebarmenu1"> <li><a href="#"></a> <ul> <li><a href="#">Example</a></li> <li><a href="#">Example</a></li> </ul> </li> </ul> </div> </div> <div id="redbutton"> <div class="sidebarmenu"> <ul id="sidebarmenu1"> <li><a href="#"></a> <ul> <li><a href="#">Example</a></li> <li><a href="#">Example</a></li> </ul> </li> </ul> </div> </div> ********************************************************** ********************************************************** <div id="footer"> <div id="footernotes"> <p> A Website by Ruddy J. Woel</p> </div></div> </div> </body> </html> CSS******************************************************* body { background-image:url(Pictures/forest2.jpg); z-index:-1; } #container { width: 860px; margin: 0 auto; height:700px; } #containerbackground { background:#ffff99; position:absolute; top:32px; width:800px; height:700px; opacity:0.8; } #header { background:#009900; position:absolute; top:2px; width:800px; height:29px; opacity:0.8; } #headertitles { position:absolute; top:1px; padding-left:20px; font-size:28px; color:#FFFFFF; font-family:Geneva, Arial, Helvetica, sans-serif; word-spacing:65px; opacity:0.9; } #content { position:absolute; top:70px; left:280px; font-size:16px; font-family:Verdana, Arial, Helvetica, sans-serif; opacity:0.8 } #yellowbutton { position:absolute; top:200px; left:260px; } .sidebarmenu ul{ margin: 0px; padding: 0px; list-style-type:none; font: 18px Verdana; width: 196px; /*main menu width*/ } .sidebarmenu ul li{ position:relative; width:197px; /*sub menu item widths*/ } /* Top level menu links style */ .sidebarmenu ul li a{ display: block; overflow: auto; /*force hasLayout in IE7 */ color: white; text-decoration: none; padding: 6px; height:22px; } .sidebarmenu ul, .sidebarmenu ul li a:visited, .sidebarmenu{ background-image:url(Pictures/yellowbutton.gif); /*background of tabs (default state)*/ } .sidebarmenu ul li a:visited{ color: white; } /*Sub level menu items */ .sidebarmenu ul li ul,.sidebarmenu ul li ul a:visited{ background-image:url(Pictures/menudrop.gif); position: absolute; width: 175px; /*Sub Menu Items width */ top: 0; visibility: hidden; } #redbutton { position:absolute; top:235px; left:260px; z-index:1; } a { text-decoration:none; color:#FFFFFF; word-spacing:40px; } #footer { background-color:#000000; position:absolute; top:733px; height:20px; width:800px; z-index:0; opacity:0.8; } #footernotes { margin-top:-10px; font-family:Geneva, Arial, Helvetica, sans-serif; font-size:14px; z-index:1; color:#FFFFFF; } JAVASCRIPT************************************************* var menuids=["sidebarmenu1"] //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) ******************************************************* Thank you for your time! Hi guys, I'm currently developing a simple website with a menu bar. Now this bar consists of several tabs, and I want to enlarge the tabs as soon as the user puts the mouse cursor over it. To illustrate this, here is the menu bar in normal mode: And when the user puts the cursor over the tab "Aktuelles", it should look like this: My idea was to use the jQuery-function .animate(), but the problem is that I use one background image for each tab and it is not possible to resize background images. I also tried to the <img> tag and change the height-attribute in the animate() function, but this doesn't work either. Well I have no idea left how I could solve this. Any help is very welcome. Thanks in advance, enne Hi - I am updating a site for a friend as the original designer has gone missing.. I am no developer by any means but know basic html etc.. I want to change a link in the drop down menu.js file, have opened it in my text editor and changed the link that needs changing to a diff page but it isn't updating on the site - arghhh!! I have notice at the top of the page it has: // QuickMenu Pro, Copyright (c) 1998 - 2003, OpenCube Inc. - http://www.opencube.com does this have anything to do with it? I can't find anything on google - any advice is greatly appreciated. Thanks I want to create a opaque menu that I can quickly access custom short-cuts etc, how can I create this for use with a specific program ?
Hello friends. I need a little help with this code i can't get to work. Under 500.000 euros a link to another website need to open when selected in the dropdown menu. Code: <input type="hidden" id="budget_min" name="budget_min" value="0" /> <input type="hidden" id="budget_max" name="budget_max" value="0" /> <select onchange="updatePriceLimit(this)"> <option value="http://othersite.com">-500.000 euros</option> <option value="500000-1000000">500.000 - 1.000.000 euros</option> <option value="1000000-2000000">1.000.000 - 2.000.000 euros</option> <option value="2000000-100000000">2.000.000+ euros</option> </select> <script type="text/javascript"> function updatePriceLimit(select) { if (select.value.search(/http/i)) { location.href=select.value; } else { var limit = select.value.split('-'); document.getElementById('budget_min').value = limit[0]; document.getElementById('budget_max').value = limit[1]; } } </script> TIA I recently created my first theme shortly after leaning css, but i am having trouble with my navbar. The main bar is a list with images, then when a user hovers over one a list drops horizontally on the bar below. Problem is when trying to click far off links it is very easy to slip and the menu disappears. What i need is some sort of delay to prevent this, or some way to make the menu show after clicking instead of hovering. Here is my code, i have two questions; 1) I have never written a theme before, is this the proper way to code a navbar? (i hear making an actual list is important) 2) How can i add a hover delay or change the submenu to be click activated? Here is a link to my test site so you can see it in action. Code: div#navi { width: 960px; height: 39px; } ul.navi { margin:-2px 0px -2px -40px; } ul.navi, ul.navi li { float: left; list-style:none; } ul.navi li ul { display: none; } ul.navi li:hover ul { display:block; list-style: none; position:absolute; } ul.navi li:hover ul li { padding-right:50px; } ul.navi li:hover ul li a{ color:#FFF; } ul.navi li:hover ul li a:hover{ color:#FFF; } div#navi2 { width: 960px; height: 29px; background-image:url(images/nav_bottom.gif); margin-top:-5px; Code: <div id="navi"> <ul class="navi"> <li><a href="/index.php"><img src="/themes/CGS_FutureWeb_Blue/images/nav_top_01.gif" /></a> <ul> <li><a href="/index.php?site=news">News</a></li> <li><a href="/index.php?site=news&action=archive">Archives</a></li> <li><a href="/index.php?site=articles">Articles</a></li> <li><a href="/index.php?site=calendar">Calendar</a></li> <li><a href="/index.php?site=faq">FAQ</a></li> <li><a href="/index.php?site=search">Search</a></li> </ul> </li> <li><a href="/index.php?site=forum"><img src="/themes/CGS_FutureWeb_Blue/images/nav_top_02.gif" /></a></li> <li><a href="/index.php?site=squads"><img src="/themes/CGS_FutureWeb_Blue/images/nav_top_03.gif" /></a> <ul style="margin-left:-255px;"> <li><a href="/index.php?site=about">About Us</a></li> <li><a href="/index.php?site=squads">Squads</a></li> <li><a href="/index.php?site=members">Members</a></li> <li><a href="/index.php?site=clanwars">Matches</a></li> <li><a href="/index.php?site=history">History</a></li> <li><a href="/index.php?site=awards">Awards</a></li> </ul> </li> <li><img src="/themes/CGS_FutureWeb_Blue/images/nav_top_04.gif" /> <ul style="margin-left:-320px;"> <li><a href="/index.php?site=forum">Forums</a></li> <li><a href="/index.php?site=guestbook">Guestbook</a></li> <li><a href="/index.php?site=registered_users">Registered Users</a></li> <li><a href="/index.php?site=whoisonline">Online Users</a></li> <li><a href="/index.php?site=polls">Polls</a></li> <li><a href="/index.php?site=server">Servers</a></li> </ul> </li> <li><img src="/themes/CGS_FutureWeb_Blue/images/nav_top_05.gif" /> <ul style="margin-left:-330px;"> <li><a href="/index.php?site=files">Downloads</a></li> <li><a href="/index.php?site=tutorials">Tutorials</a></li> <li><a href="/index.php?site=movies">Movies</a></li> <li><a href="/index.php?site=gallery">Photos</a></li> <li><a href="/index.php?site=links">Weblinks</a></li> <li><a href="/index.php?site=demos">Demos</a></li> </ul> </li> <li><img src="/themes/CGS_FutureWeb_Blue/images/nav_top_06.gif" /> <ul style="margin-left:-710px;"> <li><a href="/index.php?site=sponsors">Sponsors</a></li> <li><a href="/index.php?site=partners">Partners</a></li> <li><a href="/index.php?site=newsletter">Newsletter</a></li> <li><a href="/index.php?site=contact">Contact Us</a></li> <li><a href="/index.php?site=challenge">Fight Us</a></li> <li><a href="/index.php?site=joinus">Join Us</a></li> <li><a href="/index.php?site=linkus">Link Us</a></li> <li><a href="/index.php?site=imprint">Imprint</a></li> </ul> </li> </ul> </div> <div id="navi2"></div> Here are the two js scripts i tried, honestly I am not sure how to use them and couldn't get either to work. I think i installed them in the proper places, but i dont think i edited them to work properly; Code: var delay = 500; /* milli seconds */ function attachHooks() { var menu = document.getElementById("navi"); var menuItems = menu.getElementsByTagName("ul.navi li ul"); currentHover = menuItems[0]; for (var i = 0; i < menuItems.length; i++) { menuItems[i].onmouseover = function () {activateMenuWithDelay(this);}; menuItems[i].onmouseout = function () {deactivateMenuWithDelay(this);}; } } function activateMenuWithDelay(ele) { if(ele.timer) { clearTimeout(ele.timer); } ele.timer = setTimeout(function(){activateShowMenu(ele)}, delay); } function activateShowMenu(ele) { var parent = ele; parent.className = "showMenu"; } function deactivateMenu(ele) { var parent = ele; parent.className = " "; } function deactivateMenuWithDelay(ele) { if(ele.timer) { clearTimeout(ele.timer); } ele.timer = setTimeout(function(){deactivateMenu(ele)}, delay); } function initMenuDelay() { attachHooks(); deactivateMenu(); } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } addLoadEvent(attachHooks); Code: <script type="text/javascript"> sfHover = function() { var sfEls = document.getElementById("navi").getElementsByTagName("li"); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=" sfhover"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover); </script> Any help is appreciated! Hi Everyone, Could someone please help? I'm rewriting our website at present, and am quite ok with HTML and CSS, but am not particularly au fait with Javascript. Here's the page I'm having a bit of trouble with: http://www.ambersupplies.co.uk/thomas/miscellaneous.htm If you look at the long button marked 'Diagnostics', you'll see it has an arrow and initiates a drop-down menu on mouse-over. My problem is that I wish to further subdivide the three items on the sub-menu, ie, Visual to become sub-menued into Dermatoscope and Penlight. In other words, the Visual button initiates another drop-down menu on mouse-over. Basically, therefore, I'm trying to expand the Javascript to make this happen, but I just don't seem to able to. I'd be so very grateful for any help anyone can offer. Graham |