<?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; jQuery</title>
	<atom:link href="http://www.moonkatcreations.com/tag/jquery/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>
		<item>
		<title>Show/hide function for questions and answers</title>
		<link>http://www.moonkatcreations.com/web-design/jquery/showhide-function-for-questions-and-answers/</link>
		<comments>http://www.moonkatcreations.com/web-design/jquery/showhide-function-for-questions-and-answers/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 22:15:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[accordion navigation]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[toggle]]></category>

		<guid isPermaLink="false">http://www.moonkatcreations.com/?p=57</guid>
		<description><![CDATA[Here&#8217;s a neat little script that allows a question and answer type format, where the questions are all listed as links, and clicking on one toggles the visibility of the corresponding answer.
$("p").hide();
$("a").click(function () {
$(this).next("p:first").slideToggle("fast");
});
Here&#8217;s a version for lists that can be used to build an accordion navigation menu:
$("ul li ul").hide();
$("a").click(function () {
$(this).next("ul:first").slideToggle("fast");
});
Thanks to this post [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a neat little script that allows a question and answer type format, where the questions are all listed as links, and clicking on one toggles the visibility of the corresponding answer.</p>
<pre>$("p").hide();
$("a").click(function () {
$(this).next("p:first").slideToggle("fast");
});</pre>
<p>Here&#8217;s a version for lists that can be used to build an accordion navigation menu:</p>
<pre>$("ul li ul").hide();
$("a").click(function () {
$(this).next("ul:first").slideToggle("fast");
});</pre>
<p>Thanks to this post on Stackoverflow for the inspiration:</p>
<p>http://stackoverflow.com/questions/248320/using-this-with-jquery-selectors/248335</p>
<p>My selectors allow you to have multiple questions listed on one page. The answers given to the question on Stackoverflow only allowed for one, since, if clicked, it would toggle ALL of the paragraphs simultaneously.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moonkatcreations.com/web-design/jquery/showhide-function-for-questions-and-answers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Variables in JQuery Selectors</title>
		<link>http://www.moonkatcreations.com/web-design/jquery/using-variables-in-jquery-selectors/</link>
		<comments>http://www.moonkatcreations.com/web-design/jquery/using-variables-in-jquery-selectors/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 20:57:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.moonkatcreations.com/?p=21</guid>
		<description><![CDATA[If you want to use variables in combination with CSS-style selectors like so:
$("#navigation a.myHomePage, " + logo).hover(function() {
$("li.home").addClass("homeRoll");
}, (function() {
$("li.home").removeClass("homeRoll");
});
Make sure your variable homePageImage is written as a string:
var homePageImage = "#logo"
not an object:
var homePageImage = $("#logo")
or it won&#8217;t work.
]]></description>
			<content:encoded><![CDATA[<p>If you want to use variables in combination with CSS-style selectors like so:</p>
<pre>$("#navigation a.myHomePage, " + logo).hover(function() {
$("li.home").addClass("homeRoll");
}, (function() {
$("li.home").removeClass("homeRoll");
});</pre>
<p>Make sure your variable homePageImage is written as a string:</p>
<pre>var homePageImage = "#logo"</pre>
<p>not an object:</p>
<pre>var homePageImage = $("#logo")</pre>
<p>or it won&#8217;t work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.moonkatcreations.com/web-design/jquery/using-variables-in-jquery-selectors/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
