Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-15-2012, 02:48 PM   PM User | #1
stephen_
New Coder

 
Join Date: Jan 2012
Posts: 49
Thanks: 13
Thanked 0 Times in 0 Posts
stephen_ is an unknown quantity at this point
Adding a thrid level onto my navigation

I'm trying to add another level to a navigation bar - alls fine except I cant change the javascript so that the 3rd level menu only shows when hovering over the 2nd level menu link

The scipt behind the 2nd level hover is;

Code:
var mylib =
{
	dropDown :
	{
		init : function()
		{
			$(".sub-nav").hide();
			$(".sub-nav li:last-child").addClass("last");
			$("#nav > li").hover(function(){
				$(this).addClass("active");
				$(".sub-nav",this).show();
			},
			function(){
				$(this).removeClass("active");
				$(".sub-nav",this).hide();
			});
			
			$("#sub-nav a").click(function () {
	            $("#sub-nav").hide();
	        });
		}
	}
}
The html is:
Code:
<ul id="nav">
   <li id="1" class="first"><href="#">level 1 menu</a>
      <ul class="sub-nav">
         <li><a href="n.htm">level 2 menu</a>
              <ul class="sub-sub-nav">
                    <li><a href="#.htm">level 3 menu</a></li>
                    <li><a href="#.htm">level 3 menu</a</li></ul>
</li>
</ul>
</li>
</ul>
stephen_ is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:36 PM.


Advertisement
Log in to turn off these ads.