<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Building Dynamic Navigation Using JavaScript and jQuery</title>
	<atom:link href="http://www.clecompte.com/building-dynamic-navigation-using-javascript-and-jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.clecompte.com/building-dynamic-navigation-using-javascript-and-jquery/</link>
	<description></description>
	<lastBuildDate>Mon, 19 Jul 2010 12:47:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Dan</title>
		<link>http://www.clecompte.com/building-dynamic-navigation-using-javascript-and-jquery/comment-page-1/#comment-861</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Sun, 11 Jul 2010 12:38:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.clecompte.com/?p=238#comment-861</guid>
		<description>Excellent! Exactly what I needed to add a current page class to a dynamically created UL to get an accordion menu working. I didn&#039;t require as much code as you used and needed the whole URL as oppose to the path name so adapted the code to suit. Good explanation. 

$(document).ready(function() {  
    $(&quot;ul.nav_cat_archive li&quot;).find(&quot;a[href=&#039;&quot;+window.location.href+&quot;&#039;]&quot;).each(function() {
        $(this).addClass(&quot;current_page&quot;);
    });
}); 

Thanks</description>
		<content:encoded><![CDATA[<p>Excellent! Exactly what I needed to add a current page class to a dynamically created UL to get an accordion menu working. I didn&#8217;t require as much code as you used and needed the whole URL as oppose to the path name so adapted the code to suit. Good explanation. </p>
<p>$(document).ready(function() {<br />
    $(&#8220;ul.nav_cat_archive li&#8221;).find(&#8220;a[href='"+window.location.href+"']&#8220;).each(function() {<br />
        $(this).addClass(&#8220;current_page&#8221;);<br />
    });<br />
}); </p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris LeCompte</title>
		<link>http://www.clecompte.com/building-dynamic-navigation-using-javascript-and-jquery/comment-page-1/#comment-70</link>
		<dc:creator>Chris LeCompte</dc:creator>
		<pubDate>Wed, 26 Aug 2009 13:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.clecompte.com/?p=238#comment-70</guid>
		<description>Glad it worked for you Rick! jQuery has really motivated me to finally jump into the programming world (well, actually, I&#039;m just dipping my toes into the water)..so I&#039;ll keep at it and let you know if I find any better solutions.</description>
		<content:encoded><![CDATA[<p>Glad it worked for you Rick! jQuery has really motivated me to finally jump into the programming world (well, actually, I&#8217;m just dipping my toes into the water)..so I&#8217;ll keep at it and let you know if I find any better solutions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Hocutt</title>
		<link>http://www.clecompte.com/building-dynamic-navigation-using-javascript-and-jquery/comment-page-1/#comment-60</link>
		<dc:creator>Rick Hocutt</dc:creator>
		<pubDate>Thu, 20 Aug 2009 21:02:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.clecompte.com/?p=238#comment-60</guid>
		<description>This is great, works like a charm! I needed to alter it to remove the active class on sub menu items in the &quot;services&quot; directory in a drop down menu that uses nested lists. I then added the class back to the nested lit item when a user is on a specific page in that directory. I ended up using this to solve this:

&lt;code&gt;
var services = &quot;services&quot;;
var url = services;
var siteurl;
var locmatch;

url = url.split(/[\s\,]+/i);
siteurl = String(location.href);
for (var x = 0; x &lt; url.length; x++) {
  locmatch = siteurl.match(url[ x ]);
}

$(document).ready(function(){
  if (locmatch == services) {
    $(&quot;#nav li a[href*=&#039;services&#039;]&quot;).addClass(&quot;active&quot;);
	$(&quot;#nav li ul li a&quot;).removeClass(&quot;active&quot;);
	
	$(&quot;#nav li&quot;).find(&quot;a[href=&#039;&quot;+window.location.pathname+&quot;&#039;]&quot;).each(function(){
		$(this).addClass(&quot;active&quot;)
    });
  }
  else {
    $(&quot;#nav li&quot;).find(&quot;a[href=&#039;&quot;+window.location.pathname+&quot;&#039;]&quot;).each(function(){
      $(this).addClass(&quot;active&quot;)
    });
  };
});
&lt;/code&gt;

I&#039;m like you Chris I&#039;m not the best programmer so there&#039;s probably a better way of achieving this effect. Let me know if you know of one. At any rate it seems to do the job.

Thanks!</description>
		<content:encoded><![CDATA[<p>This is great, works like a charm! I needed to alter it to remove the active class on sub menu items in the &#8220;services&#8221; directory in a drop down menu that uses nested lists. I then added the class back to the nested lit item when a user is on a specific page in that directory. I ended up using this to solve this:</p>
<p><code><br />
var services = "services";<br />
var url = services;<br />
var siteurl;<br />
var locmatch;</p>
<p>url = url.split(/[\s\,]+/i);<br />
siteurl = String(location.href);<br />
for (var x = 0; x &lt; url.length; x++) {<br />
  locmatch = siteurl.match(url[ x ]);<br />
}</p>
<p>$(document).ready(function(){<br />
  if (locmatch == services) {<br />
    $(&quot;#nav li a[href*=&#039;services&#039;]&quot;).addClass(&quot;active&quot;);<br />
	$(&quot;#nav li ul li a&quot;).removeClass(&quot;active&quot;);</p>
<p>	$(&quot;#nav li&quot;).find(&quot;a[href=&#039;&quot;+window.location.pathname+&quot;&#039;]&quot;).each(function(){<br />
		$(this).addClass(&quot;active&quot;)<br />
    });<br />
  }<br />
  else {<br />
    $(&quot;#nav li&quot;).find(&quot;a[href=&#039;&quot;+window.location.pathname+&quot;&#039;]&quot;).each(function(){<br />
      $(this).addClass(&quot;active&quot;)<br />
    });<br />
  };<br />
});<br />
</code></p>
<p>I&#8217;m like you Chris I&#8217;m not the best programmer so there&#8217;s probably a better way of achieving this effect. Let me know if you know of one. At any rate it seems to do the job.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
