<?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>MoonKat Creations &#187; accordion menu</title>
	<atom:link href="http://www.moonkatcreations.com/tag/accordion-menu/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.moonkatcreations.com</link>
	<description>Not just another WordPress blog about web design</description>
	<lastBuildDate>Tue, 27 Jul 2010 04:50:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Super Easy jQuery Accordion Menu</title>
		<link>http://www.moonkatcreations.com/web-design/html/super-easy-jquery-accordion-menu/</link>
		<comments>http://www.moonkatcreations.com/web-design/html/super-easy-jquery-accordion-menu/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 22:17:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[accordion menu]]></category>
		<category><![CDATA[navigation]]></category>

		<guid isPermaLink="false">http://www.moonkatcreations.com/?p=228</guid>
		<description><![CDATA[I created this accordion menu rather on accident. (See my previous post, ). I was actually writing jQuery to make a show/hide question answer list, and realized it would be really easy to turn it into an accordion menu.

Here's the result:]]></description>
			<content:encoded><![CDATA[<p>I created this accordion menu rather on accident. (See my previous post, ). I was actually writing jQuery to make a show/hide question answer list, and realized it would be really easy to turn it into an accordion menu.</p>
<p>Here&#8217;s the result:</p>
<ul id="accordian_menu">
<li><a class="toggleLink" href="#">Our Company</a>
<ul class="hidden">
<li><a href="#">About Us</a></li>
<li><a href="#">History</a></li>
</ul>
</li>
<li><a class="toggleLink" href="#">Products/Services</a>
<ul class="hidden">
<li><a href="#">Custom Web Design</a></li>
<li><a href="#">Content Management Solutions</a></li>
<li><a href="#">Website Optimization</a></li>
<li><a href="#">Email Campaigns</a></li>
</ul>
</li>
<li><a class="toggleLink" href="#">Portfolio</a>
<ul class="hidden">
<li><a href="#">Static HTML</a></li>
<li><a href="#">Wordpress Themes</a></li>
<li><a href="#">Emails</a></li>
</ul>
</li>
<li><a class="toggleLink" href="#">Contact</a>
<ul class="hidden">
<li><a href="#">Phone</a></li>
<li><a href="#">Email</a></li>
<li><a href="#">Request a Quote</a></li>
</ul>
</li>
</ul>
<p>How to create it:</p>
<p>1. Include the jQuery library in your page with a script tag. Example:</p>
<pre>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/
jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;</pre>
<p>This example links directly to the jQuery library hosted on google. You may link to your own copy.</p>
<p>2. Create a new .js document, and add this code:</p>
<pre>$(document).ready(function(){
	$("ul.hidden").hide();
	$("a.toggleLink").click(function () {
		$("ul.hidden").not($(this).next("ul:first")).slideUp();
		$(this).next("ul:first").slideToggle("normal");
	});
});</pre>
<p>Add this file using the &lt;script&gt; tag.</p>
<p>3. Add this to the body of your page:</p>
<pre>&lt;ul id="accordian_menu"&gt;

     &lt;li&gt;&lt;a href="#" class="toggleLink"&gt;Our Company&lt;/a&gt;

     &lt;ul class="hidden"&gt;

     &lt;li&gt;&lt;a href="#"&gt;About Us&lt;/a&gt;&lt;/li&gt;

     &lt;li&gt;&lt;a href="#"&gt;History&lt;/a&gt;&lt;/li&gt;

     &lt;/ul&gt;

     &lt;/li&gt;

     &lt;li&gt;&lt;a href="#" class="toggleLink"&gt;Products/Services&lt;/a&gt;

     &lt;ul class="hidden"&gt;

     &lt;li&gt;&lt;a href="#"&gt;Custom Web Design&lt;/a&gt;&lt;/li&gt;

     &lt;li&gt;&lt;a href="#"&gt;Content Management Solutions&lt;/a&gt;&lt;/li&gt;

     &lt;li&gt;&lt;a href="#"&gt;Website Optimization&lt;/a&gt;&lt;/li&gt;

     &lt;li&gt;&lt;a href="#"&gt;Email Campaigns&lt;/a&gt;&lt;/li&gt;

     &lt;/ul&gt;

     &lt;/li&gt;

     &lt;li&gt;&lt;a href="#" class="toggleLink"&gt;Portfolio&lt;/a&gt;

     &lt;ul class="hidden"&gt;

     &lt;li&gt;&lt;a href="#"&gt;Static HTML&lt;/a&gt;&lt;/li&gt;

     &lt;li&gt;&lt;a href="#"&gt;Wordpress Themes&lt;/a&gt;&lt;/li&gt;

     &lt;li&gt;&lt;a href="#"&gt;Emails&lt;/a&gt;&lt;/li&gt;

     &lt;/ul&gt;

     &lt;/li&gt;

     &lt;li&gt;&lt;a href="#" class="toggleLink"&gt;Contact&lt;/a&gt;

     &lt;ul class="hidden"&gt;

     &lt;li&gt;&lt;a href="#"&gt;Phone&lt;/a&gt;&lt;/li&gt;

     &lt;li&gt;&lt;a href="#"&gt;Email&lt;/a&gt;&lt;/li&gt;

     &lt;li&gt;&lt;a href="#"&gt;Request a Quote&lt;/a&gt;&lt;/li&gt;

     &lt;/ul&gt;

     &lt;/li&gt;

&lt;/ul&gt;</pre>
<p>4. Add these classes to your stylesheet:</p>
<pre>a {
	text-decoration: none;
}
a.toggleLink {
	display: block;
	padding: 5px;
	background: #936;
	color: white;
	border-bottom:1px dotted #CC99CC;
	}
ul#accordian_menu {
	margin: 0;
	padding: 0;
	width: 150px;
}
ul#accordian_menu li {
	list-style-type: none;
}
ul#accordian_menu li ul {
	padding-left: 0;
	background: #FFDAEE;
}
ul#accordian_menu li ul li {
}
ul#accordian_menu li ul li a:hover {
	background: white;
}
ul#accordian_menu li ul li a {
	color: #936;
	display: block;
	border-bottom: 1px dotted #C9C;
	padding: 5px;
}</pre>
<p>These classes could probably be refined a little, but I kept them pretty specific so they won&#8217;t conflict with any similar markup that might be in your page. Feel free to rename or change them to suit your needs.</p>
<p><strong>Take it further:</strong></p>
<ul>
<li>Use divs or paragraphs instead of list items to make a show/hide section of content.</li>
<li>If static (non-sliding content) will be wedged anywhere between your sliding elements, you must use the .nextAll() method, instead of .next().</li>
</ul>
<p>Note: If you&#8217;re new to jQuery, you only need to include the $(document).ready(function()) once in your javascript document&#8211;wrap it around all of your functions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moonkatcreations.com/web-design/html/super-easy-jquery-accordion-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
