<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>To The Point &#187; Navigation</title>
	<atom:link href="http://sharepoint.inproc.com/tag/navigation/feed/" rel="self" type="application/rss+xml" />
	<link>http://sharepoint.inproc.com</link>
	<description>Tom Dietz&#039;s Musings on SharePoint and .NET Development</description>
	<lastBuildDate>Fri, 29 Jan 2010 19:44:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Creating Mega Drop Down Navigation in SharePoint with jQuery &#8211; Part 2</title>
		<link>http://sharepoint.inproc.com/creating-mega-drop-down-navigation-in-sharepoint-with-jquery-part-2/</link>
		<comments>http://sharepoint.inproc.com/creating-mega-drop-down-navigation-in-sharepoint-with-jquery-part-2/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 18:06:24 +0000</pubDate>
		<dc:creator>tdietz</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[CSS.MegaDropDown]]></category>
		<category><![CDATA[Mega Drop Down]]></category>

		<guid isPermaLink="false">http://sharepoint.inproc.com/?p=142</guid>
		<description><![CDATA[This is part two in a three part series for implementing Mega Drop Down navigation in SharePoint 2007.&#160; The topics covered are: Part 1 – Tables, Unordered Lists, and SharePoint Part 2 – Custom Control Rendering Part 3 – Hooking it all up with jQuery Since the out-of-the-box SharePoint menu control renders the HTML in [...]]]></description>
			<content:encoded><![CDATA[<p>This is part two in a three part series for implementing Mega Drop Down navigation in SharePoint 2007.&#160; The topics covered are:</p>
<p> <a href="http://tothepoint.inproc.com/creating-mega-drop-down-navigation-in-sharepoint-2007-with-jquery/">Part 1 – Tables, Unordered Lists, and SharePoint</a>   <br /><strong>Part 2 – Custom Control Rendering</strong>   <br />Part 3 – Hooking it all up with jQuery   </p>
<p>Since the out-of-the-box SharePoint menu control renders the HTML in &lt;TABLE&gt; elements,skinning and customizations are limited.&#160; The rendering for my MegaDropDown is based on the &lt;DIV&gt; and &lt;UL&gt; elements and provides many more customization options.&#160; <em>Note:&#160; In SharePoint 2010, the AspMenu control has an </em><a href="http://blog.drisgill.com/2009/11/sp2010-branding-tip-7-using-simple.html" target="_blank"><em>option to render</em></a><em> with &lt;UL&gt; based elements.&#160; I haven’t ported the MegaDropDown to SP2010 yet, but will post my results when I get a chance to convert it.</em></p>
<p>Once you bind to the navigation’s data source, you can easily walk through the collection of items and render HTML on the fly. I was doing this in my first iteration of the MDD, but things got a little complicated as I needed to parse all the available menu options, and then apply some custom jQuery logic once I had everything calculated.&#160; That said, I opted for a two pass approach:</p>
<p>Pass 1 – Iterate through the navigation data source and build my own customized collection that stored some extended properties that were specific to the MDD.</p>
<p>Pass 2 – Iterate through the custom collection and render the HTML</p>
<p>While there is obviously an extra step involved (and another copy of the navigation), it <strong>really</strong> simplified the code and the overall process.</p>
<p>The custom collection essentially consists of several container classes that keep track of the navigation items (Title, Url, Type).&#160; The first two properties are pretty obvious but Type is tailored for the MDD.&#160; Type determines if the item is a standard menu item or is an image.&#160; A benefit of the MDD is that is has the ability to display a site “image” within the navigation drop down itself (more on this later).</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ff86bd94-49ea-4ae5-ac51-9a234ed1deb6" class="wlWriterSmartContent">
<div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &quot;Courier New&quot;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid">
<div style="padding-bottom: 2px; padding-left: 5px; padding-right: 5px; font-family: verdana, tahoma, arial, sans-serif; background: #000080; color: #fff; font-weight: bold; padding-top: 2px">Code Snippet</div>
<div style="background: #ddd; max-height: 300px; overflow: auto">
<ol style="padding-bottom: 0px; margin: 0px 0px 0px 2.5em; padding-left: 5px; padding-right: 0px; background: #ffffff; padding-top: 0px">
<li>[<span style="color: #2b91af">Serializable</span>] </li>
<li style="background: #f3f3f3"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> <span style="color: #2b91af">MenuItem</span> </li>
<li>{ </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Name; </li>
<li>&#160;&#160;&#160; <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Html; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">public</span> <span style="color: #0000ff">string</span> Url; </li>
<li>&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">public</span> MenuItem() { } </li>
<li>&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">public</span> MenuItem(<span style="color: #0000ff">string</span> name, <span style="color: #0000ff">string</span> html, <span style="color: #0000ff">string</span> url) </li>
<li>&#160;&#160;&#160; { </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; Name = name; </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Html = html; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; Url = url; </li>
<li>&#160;&#160;&#160; } </li>
<li style="background: #f3f3f3">&#160; </li>
<li>&#160;&#160;&#160; <span style="color: #0000ff">public</span> <span style="color: #2b91af">MenuItemType</span> Type; </li>
<li style="background: #f3f3f3">}</li>
</ol></div>
</p></div>
</p></div>
<h4>Displaying and grouping items</h4>
<p>There are two formats for displaying menu items: standard and grouped.&#160; Standard is just what you would expect and menu items are rendered in the order defined in SharePoint.&#160; Grouped items however, allow you to organize links into categories which can significantly simplify the interface when needing to display dozens of links.&#160; A major requirement of the MDD project was to keep the customization as transparent and compatible with SharePoint as possible.&#160; The grouping logic is one place where some customizations are visible.&#160; In order to group items there needs to be a way to define the group name (i.e. category) as well as the links are associated with each category.&#160; </p>
<p><a href="http://sharepoint.inproc.com/wp-content/uploads/2010/01/NavUnGrouped.png" rel="lightbox" title="Navigation with ungrouped links"><img  title="Nav UnGrouped" border="0" alt="Nav UnGrouped" src="http://sharepoint.inproc.com/wp-content/uploads/2010/01/NavUnGrouped.png" /></a>
<p><strong><font color="#ff8000">MegaDropDown with uncategorized items</font></strong></p>
<p> <a href="http://sharepoint.inproc.com/wp-content/uploads/2010/01/NavGrouped.png" rel="lightbox" title="Navigation with grouped links"><img title="Nav Grouped" border="0" alt="Nav Grouped" src="http://sharepoint.inproc.com/wp-content/uploads/2010/01/NavGrouped.png"/></a>
<p><strong><font color="#ff8000">MegaDropDown with categorized items</font></strong></p>
<p>The client I was working with was very adamant about using the standard SharePoint &quot;Modify Navigation” UI so I am not entirely happy with the solution for grouping, but it does solve the problem without building any new web forms or pages.&#160; A special syntax was created so an admin simply has to enter it within the standard UI.&#160; When you want to specify that a link should fall within a specific group, you append the link title with $GroupName.&#160; For example, if you wanted to create a group named <strong>Offices</strong> and add the <strong>Chicago</strong> office, you would enter:</p>
<p>Chicago$Offices</p>
<p>That’s it.&#160; The parsing code will detect this and separate out the names automatically.&#160; Here’s how it would look in the Navigation Link dialog:</p>
<p><a href="http://sharepoint.inproc.com/wp-content/uploads/2010/01/image3.png" rel="lightbox" title="Navigation Link Dialog"><img title="Navigation Link Dialog" border="0" alt="image" src="http://sharepoint.inproc.com/wp-content/uploads/2010/01/image3.png" /></a> </p>
<p>As I said, I don’t exactly like the approach, but it is a pretty low-impact solution and took about 20 minutes to write the parsing code—and no UI changes were needed!</p>
<p>I keep track of each MenuItem in a generic List.&#160; Since there are two types of dropdowns (standard and grouped), I keep track of each link type in a separate List.&#160; </p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0be9e58d-89b1-4456-a67b-cce7bc36e870" class="wlWriterSmartContent">
<div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &quot;Courier New&quot;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid">
<div style="padding-bottom: 2px; padding-left: 5px; padding-right: 5px; font-family: verdana, tahoma, arial, sans-serif; background: #000080; color: #fff; font-weight: bold; padding-top: 2px">Code Snippet</div>
<div style="background: #ddd; max-height: 300px; overflow: auto">
<ol style="padding-bottom: 0px; margin: 0px 0px 0px 2.5em; padding-left: 5px; padding-right: 0px; background: #ffffff; padding-top: 0px">
<li>[<span style="color: #2b91af">Serializable</span>] </li>
<li style="background: #f3f3f3"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> <span style="color: #2b91af">MenuNode</span> : <span style="color: #2b91af">MenuItem</span> </li>
<li>{ </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">public</span> <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">MenuGroup</span>&gt; Groups = <span style="color: #0000ff">new</span> <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">MenuGroup</span>&gt;(); </li>
<li>&#160;&#160;&#160; <span style="color: #0000ff">public</span> <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">MenuItem</span>&gt; Items = <span style="color: #0000ff">new</span> <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">MenuItem</span>&gt;(); </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">public</span> <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">MenuNode</span>&gt; Nodes = <span style="color: #0000ff">new</span> <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">MenuNode</span>&gt;(); </li>
<li>&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">public</span> MenuNode() { } </li>
<li>&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">public</span> MenuNode(<span style="color: #0000ff">string</span> name, <span style="color: #0000ff">string</span> html, <span style="color: #0000ff">string</span> url) </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; : <span style="color: #0000ff">base</span>(name, html, url) </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; { </li>
<li>&#160;&#160;&#160; } </li>
<li style="background: #f3f3f3">&#160; </li>
<li>&#160;&#160;&#160; <span style="color: #0000ff">public</span> <span style="color: #2b91af">MenuState</span> State; </li>
<li style="background: #f3f3f3">}</li>
</ol></div>
</p></div>
</p></div>
<p>&#160;</p>
<p>Keeping track of all of the navigation types is a little tricky, so hopefully the following diagram helps illustrate how the collections relate:</p>
<p>Once all the parsing is done and I am ready to render the items, I simply iterate through each list and generate the HTML:&#160;&#160; For brevity, I’ve removed some of the housekeeping logic, but the RenderMenus() method walks the main List&lt;&gt; and calls RenderGroupItems or RenderMenuItems() accordingly:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:69b1e346-3fca-42fd-979d-a534855f8a92" class="wlWriterSmartContent">
<div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &quot;Courier New&quot;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid">
<div style="padding-bottom: 2px; padding-left: 5px; padding-right: 5px; font-family: verdana, tahoma, arial, sans-serif; background: #000080; color: #fff; font-weight: bold; padding-top: 2px">Code Snippet</div>
<div style="background: #ddd; max-height: 300px; overflow: auto">
<ol style="padding-bottom: 0px; margin: 0px 0px 0px 2.5em; padding-left: 5px; padding-right: 0px; background: #ffffff; padding-top: 0px">
<li><span style="color: #0000ff">private</span> <span style="color: #0000ff">bool</span> RenderMenus() </li>
<li style="background: #f3f3f3">{ </li>
<li>&#160;&#160;&#160; <span style="color: #0000ff">int</span> menuCount = 0; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">string</span> _menuItem = <span style="color: #a31515">&quot;&lt;li class=&#8217;menuitem{0}&#8217;&gt;&lt;a href=&#8217;{1}&#8217;&gt;&lt;span class=&#8217;menuitem{2}&#8217;&gt;{3}&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&quot;</span>; </li>
<li>&#160;&#160;&#160; <span style="color: #0000ff">string</span> _parentMenuItem = <span style="color: #a31515">&quot;&lt;li class=&#8217;nav_sites{0} menuitem{1}&#8217;&gt;&lt;a href=&#8217;{2}&#8217;&gt;&lt;span class=&#8217;groupmenuitem{3}&#8217;&gt;{4}&lt;/span&gt;&lt;/a&gt;&quot;</span>; </li>
<li style="background: #f3f3f3">&#160; </li>
<li>&#160;&#160;&#160; writer.Write(<span style="color: #a31515">&quot;&lt;ul id=&#8217;navigation&#8217;&gt;&quot;</span>); </li>
<li style="background: #f3f3f3">&#160; </li>
<li>&#160;&#160;&#160; <span style="color: #008000">// renders the top level menu (horizontal navigation bar)</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">foreach</span> (MenuNode node <span style="color: #0000ff">in</span> _menuNodes) </li>
<li>&#160;&#160;&#160; { </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">string</span> current = <span style="color: #0000ff">string</span>.Empty; </li>
<li>&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #008000">// if this site (or any sub-site within) is the current site, add a CSS style so we can hightlight it</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">if</span> (node.State == MenuState.MenuSelected) </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; current = <span style="color: #a31515">&quot; current&quot;</span>; </li>
<li>&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #008000">// just a single-level menu item (no kids)</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">if</span> ((node.Items.Count == 0) &amp;&amp; (node.Groups.Count == 0)) </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; { </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; output = <span style="color: #0000ff">string</span>.Format(_menuItem, current, node.Url, current, node.Name); </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; writer.Write(output); </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">else</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; { </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">if</span> (node.Groups.Count &gt; 0)&#160; <span style="color: #008000">// traverse all groups</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; output = <span style="color: #0000ff">string</span>.Format(_parentMenuItem, menuCount, current, node.Url, current, node.Name); </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; writer.Write(output); </li>
<li style="background: #f3f3f3">&#160; </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; RenderGroupItems(writer, node, menuCount); </li>
<li style="background: #f3f3f3">&#160; </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; writer.Write(<span style="color: #a31515">&quot;&lt;/li&gt;&quot;</span>); </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">else</span> <span style="color: #0000ff">if</span> (node.Items.Count &gt; 0) </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; output = <span style="color: #0000ff">string</span>.Format(_parentMenuItem, menuCount, current, node.Url, current, node.Name); </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; writer.Write(output); </li>
<li>&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; scriptBlock = RenderMenuItems(writer, node.Items, menuCount); </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; scripts.Add(scriptBlock); </li>
<li style="background: #f3f3f3">&#160; </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; writer.Write(<span style="color: #a31515">&quot;&lt;/li&gt;&quot;</span>); </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </li>
<li>&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; menuCount++; </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; } </li>
<li>}</li>
</ol></div>
</p></div>
</p></div>
<h4>Rendering Menu Items</h4>
<p>For the most part, displaying each of the menu items involves the same logic except you iterate through each of the top level items menus.&#160; As you read each item, you just emit individual &lt;li&gt; elements that represent each of the menus. </p>
<p><a href="http://sharepoint.inproc.com/wp-content/uploads/2010/01/nav_gr2.jpg" rel="lightbox" title="Mega Drop Down Layout"><img  border="0" alt="nav_gr" src="http://sharepoint.inproc.com/wp-content/uploads/2010/01/nav_gr2.jpg" /></a> </p>
<p>The end result of the HTML might look something like this: </p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:65f2daef-2853-463a-ab33-38d861d1aa83" class="wlWriterSmartContent"></div>
<div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &quot;Courier New&quot;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid">
<div style="padding-bottom: 2px; padding-left: 5px; padding-right: 5px; font-family: verdana, tahoma, arial, sans-serif; background: #000080; color: #fff; font-weight: bold; padding-top: 2px">Code Snippet</div>
<div style="background: #ddd; max-height: 300px; overflow: auto">
<ol style="padding-bottom: 0px; margin: 0px 0px 0px 2.5em; padding-left: 5px; padding-right: 0px; background: #ffffff; padding-top: 0px">
<li><span style="color: #0000ff">&lt;</span><span style="color: #a31515">div</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;navcontainer&quot;&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">ul</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#8217;navigation&#8217;&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">li</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;menuitem current&#8217;&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">a</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&#8217;/Pages/Default.aspx&#8217;&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">span</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;menuitem current&#8217;&gt;</span>Home<span style="color: #0000ff">&lt;/</span><span style="color: #a31515">span</span><span style="color: #0000ff">&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">a</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">li</span><span style="color: #0000ff">&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">li</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;menuitem&#8217;&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">a</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&#8217;/news&#8217;&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">span</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;menuitem&#8217;&gt;</span>News<span style="color: #0000ff">&lt;/</span><span style="color: #a31515">span</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">a</span><span style="color: #0000ff">&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">li</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">li</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;nav_sites0 menuitem&#8217;&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">a</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&#8217;/locations&#8217;&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">span</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;groupmenuitem&#8217;&gt;</span>Locations<span style="color: #0000ff">&lt;/</span><span style="color: #a31515">span</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">a</span><span style="color: #0000ff">&gt;</span> </li>
<li style="background: #f3f3f3">&#160; </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">div</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#8217;menu0&#8242;</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;menu&#8217;&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">div</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;menunavitems&#8217;</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#8217;menunavitems_1&#8242;&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">table</span> <span style="color: #ff0000">cellpadding</span><span style="color: #0000ff">=&#8217;0&#8242;</span> <span style="color: #ff0000">cellspacing</span><span style="color: #0000ff">=&#8217;0&#8242;</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;navlinklayout&#8217;</span> <span style="color: #ff0000">width</span><span style="color: #0000ff">=&#8217;100%&#8217;</span> <span style="color: #ff0000">border</span><span style="color: #0000ff">=&#8217;0&#8242;&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">tr</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">td</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;grouplayout&#8217;</span> <span style="color: #ff0000">valign</span><span style="color: #0000ff">=&#8217;top&#8217;&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">h3</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;cat_header&#8217;&gt;</span>Offices<span style="color: #0000ff">&lt;/</span><span style="color: #a31515">h3</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">ul</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;sub_nav&#8217;</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#8217;1&#8242;&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">li</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">a</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&#8217;/offices/chicago&#8217;&gt;&lt;</span><span style="color: #a31515">span</span><span style="color: #0000ff">&gt;</span>Chcago<span style="color: #0000ff">&lt;/</span><span style="color: #a31515">span</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #a31515">a</span><span style="color: #0000ff">&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">li</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">li</span><span style="color: #0000ff">&gt;&lt;</span><span style="color: #a31515">a</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&#8217;/offices/newyork&#8217;&gt;&lt;</span><span style="color: #a31515">span</span><span style="color: #0000ff">&gt;</span>New York<span style="color: #0000ff">&lt;/</span><span style="color: #a31515">span</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #a31515">a</span><span style="color: #0000ff">&gt;&lt;/</span><span style="color: #a31515">li</span><span style="color: #0000ff">&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">ul</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">td</span><span style="color: #0000ff">&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">tr</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">table</span><span style="color: #0000ff">&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">div</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">div</span><span style="color: #0000ff">&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">li</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">li</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;menuitem&#8217;&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">a</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&#8217;/reports&#8217;&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;</span><span style="color: #a31515">span</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#8217;menuitem&#8217;&gt;</span>Reports<span style="color: #0000ff">&lt;/</span><span style="color: #a31515">span</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">a</span><span style="color: #0000ff">&gt;</span> </li>
<li style="background: #f3f3f3">&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">li</span><span style="color: #0000ff">&gt;</span> </li>
<li>&#160; </li>
<li style="background: #f3f3f3">&#160;&#160;&#160; <span style="color: #0000ff">&lt;/</span><span style="color: #a31515">ul</span><span style="color: #0000ff">&gt;</span> </li>
<li><span style="color: #0000ff">&lt;/</span><span style="color: #a31515">div</span><span style="color: #0000ff">&gt;</span></li>
</ol></div>
</p></div>
<p>&#160;</p>
<p>The code is fairly straightforward and I tried to make the HTML as simple as possible.&#160; The entire navigation, including the mega drop down sits inside the main &lt;div&gt; container ‘navcontainer’.&#160; The ‘navigation’ &lt;UL&gt; handles the horizontal top ‘tabbed’ navigation menu.&#160; Since it is &lt;UL&gt; based, I style the layout and appearance with CSS.&#160; Each &lt;LI&gt; represents a tab defined in SharePoint’s navigation page.&#160; </p>
<p>When sub-navigation items exists (e.g. sub-sites), a new &lt;DIV&gt; (menu) is defines the drop down itself.&#160;&#160; Although I tried to follow a flexible &lt;DIV&gt; based layout, the sub-items list is tabular and fits nicely in a &lt;TABLE&gt;.&#160;&#160; If grouping exists, each group (or category) is displayed with a styled &lt;H3&gt;.&#160; All the sub-items are then displayed with an embedded &lt;UL&gt; (sub-nav).</p>
<p>In my next and final article, I will explain how I hook it all up with jQuery.&#160; (I promise that it won’t be nearly as long between postings).</p>
<p>As always, comment or email me if you have any questions.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsharepoint.inproc.com%2Fcreating-mega-drop-down-navigation-in-sharepoint-with-jquery-part-2%2F&amp;title=Creating%20Mega%20Drop%20Down%20Navigation%20in%20SharePoint%20with%20jQuery%20%26%238211%3B%20Part%202" id="wpa2a_4"><img src="http://sharepoint.inproc.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fsharepoint.inproc.com%2Fcreating-mega-drop-down-navigation-in-sharepoint-with-jquery-part-2%2F&amp;title=Creating%20Mega%20Drop%20Down%20Navigation%20in%20SharePoint%20with%20jQuery%20%26%238211%3B%20Part%202" id="wpa2a_6"><img src="http://sharepoint.inproc.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://sharepoint.inproc.com/creating-mega-drop-down-navigation-in-sharepoint-with-jquery-part-2/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

