<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.1.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Auto-selecting navigation</title>
	<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/</link>
	<description>Left Logic articles and news / Left Logic is a Brighton based web development and design consultancy</description>
	<pubDate>Sat, 11 Oct 2008 19:19:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.2</generator>

	<item>
		<title>By: Kelvin Luck</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-275</link>
		<author>Kelvin Luck</author>
		<pubDate>Mon, 04 Sep 2006 12:13:30 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-275</guid>
					<description>&lt;p&gt;Nice solution - very clean, especially in jQuery!&lt;/p&gt;

&lt;p&gt;How about changing:&lt;/p&gt;

&lt;p&gt;window.onload = function() {&lt;/p&gt;

&lt;p&gt;to:&lt;/p&gt;

&lt;p&gt;$(document).ready(function() {&lt;/p&gt;

&lt;p&gt;in the jQuery version? It seems a little more jQueryish and you don't need to worry about overwriting or being overwritten by any other document.onload scripts (which the current script could do),&lt;/p&gt;

&lt;p&gt;Cheers,&lt;/p&gt;

&lt;p&gt;Kelvin :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nice solution - very clean, especially in jQuery!</p>
<p>How about changing:</p>
<p>window.onload = function() {</p>
<p>to:</p>
<p>$(document).ready(function() {</p>
<p>in the jQuery version? It seems a little more jQueryish and you don't need to worry about overwriting or being overwritten by any other document.onload scripts (which the current script could do),</p>
<p>Cheers,</p>
<p>Kelvin :)</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Fallo</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-276</link>
		<author>Fallo</author>
		<pubDate>Tue, 19 Sep 2006 00:43:27 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-276</guid>
					<description>&lt;p&gt;With the jquery 1.0 +&lt;/p&gt;

&lt;p&gt;$(document).ready(function(){
  if (location.pathname.substring(1))
    $(&#8217;#linklist a[@href$=&#8221;&#8217; + location.pathname.substring(1) + &#8217;&#8221;]&#8217;).attr(&#8216;class&#8217;, &#8216;here&#8217;);&lt;br /&gt;
});&lt;/p&gt;

&lt;p&gt;change the .set to .attr&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>With the jquery 1.0 +</p>
<p>$(document).ready(function(){<br />
  if (location.pathname.substring(1))<br />
    $(&#8217;#linklist a[@href$=&#8221;&#8217; + location.pathname.substring(1) + &#8217;&#8221;]&#8217;).attr(&#8216;class&#8217;, &#8216;here&#8217;);<br />
});</p>
<p>change the .set to .attr</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Steve</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-277</link>
		<author>Steve</author>
		<pubDate>Sat, 23 Sep 2006 23:12:32 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-277</guid>
					<description>&lt;p&gt;$(document).ready(function(){}) is the same as $(function(){}).&lt;/p&gt;

&lt;p&gt;So we can even shorten it further.&lt;/p&gt;

&lt;p&gt;$(function(){ if (location.pathname.substring(1)) $(â€™#linklist a[@href$=â€â€™ + location.pathname.substring(1) + â€™â€]â€™).attr(â€˜classâ€™, â€˜hereâ€™);&lt;br /&gt;
});&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>$(document).ready(function(){}) is the same as $(function(){}).</p>
<p>So we can even shorten it further.</p>
<p>$(function(){ if (location.pathname.substring(1)) $(â€™#linklist a[@href$=â€â€™ + location.pathname.substring(1) + â€™â€]â€™).attr(â€˜classâ€™, â€˜hereâ€™);<br />
});</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Gios</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-284</link>
		<author>Gios</author>
		<pubDate>Thu, 05 Oct 2006 03:46:08 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-284</guid>
					<description>&lt;p&gt;Here is another way:&lt;/p&gt;

&lt;p&gt;$(function(){
    $(&#8221;#menu&#8221;).find(&#8220;a&#8221;).each(function(){
        if( location.href.indexOf(this.href) != -1) {
            $(this).addClass(&#8220;here&#8221;);
        }
    });&lt;br /&gt;
});&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Here is another way:</p>
<p>$(function(){<br />
    $(&#8221;#menu&#8221;).find(&#8220;a&#8221;).each(function(){<br />
        if( location.href.indexOf(this.href) != -1) {<br />
            $(this).addClass(&#8220;here&#8221;);<br />
        }<br />
    });<br />
});</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: federico</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-278</link>
		<author>federico</author>
		<pubDate>Fri, 20 Oct 2006 20:02:31 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-278</guid>
					<description>&lt;p&gt;hello, i have tried your jquery script but it is not working&#8230;  is it because my links are in this format? Any ideas?&lt;/p&gt;

&lt;p&gt;&#60;ul id=&#8221;mainmenu&#8221;&#62;&lt;br /&gt;
&#60;li&#62;&#60;a href=&#8221;/index.php?page=home&#8221;&#62;Home&#60;/a&#62;&#60;/li&#62;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>hello, i have tried your jquery script but it is not working&#8230;  is it because my links are in this format? Any ideas?</p>
<p>&lt;ul id=&#8221;mainmenu&#8221;&gt;<br />
&lt;li&gt;&lt;a href=&#8221;/index.php?page=home&#8221;&gt;Home&lt;/a&gt;&lt;/li&gt;</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Adam Messinger</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-279</link>
		<author>Adam Messinger</author>
		<pubDate>Mon, 06 Nov 2006 05:37:45 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-279</guid>
					<description>&lt;p&gt;You can actually do this without any JavaScript at all, using only CSS. &lt;a href="http://www.456bereastreet.com/archive/200503/setting_the_current_menu_state_with_css/"&gt;Roger Johansson has a tutorial&lt;/a&gt;.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You can actually do this without any JavaScript at all, using only CSS. <a href="http://www.456bereastreet.com/archive/200503/setting_the_current_menu_state_with_css/">Roger Johansson has a tutorial</a>.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Elisa</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-281</link>
		<author>Elisa</author>
		<pubDate>Wed, 29 Nov 2006 09:25:43 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-281</guid>
					<description>&lt;p&gt;Hi, I tried the script but it only works with Internet Explorer 7. With other browsers it doesn&#8217;t work&#8230; That&#8217;s right?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi, I tried the script but it only works with Internet Explorer 7. With other browsers it doesn&#8217;t work&#8230; That&#8217;s right?</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Remy</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-282</link>
		<author>Remy</author>
		<pubDate>Wed, 29 Nov 2006 12:31:43 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-282</guid>
					<description>&lt;p&gt;@Elisa &#8211; to honest I&#8217;ve not tried the script in IE 7 yet &#8211; but I can confirm that it works in Safari and Firefox.  I use it for my own sidebar links and it works fine for me.  &lt;/p&gt;

&lt;p&gt;Maybe you could post an example?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Elisa &#8211; to honest I&#8217;ve not tried the script in IE 7 yet &#8211; but I can confirm that it works in Safari and Firefox.  I use it for my own sidebar links and it works fine for me.  </p>
<p>Maybe you could post an example?</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Michael</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-283</link>
		<author>Michael</author>
		<pubDate>Mon, 04 Dec 2006 19:29:09 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-283</guid>
					<description>&lt;p&gt;The method referenced by Adam above using only CSS only works for the top level of navigation.  If you have multiple levels that you need highlighting to work for, you&#8217;d need to add a lot more css and html to your code.&lt;/p&gt;

&lt;p&gt;The method in this tutorial is very elegant.  Thanks&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The method referenced by Adam above using only CSS only works for the top level of navigation.  If you have multiple levels that you need highlighting to work for, you&#8217;d need to add a lot more css and html to your code.</p>
<p>The method in this tutorial is very elegant.  Thanks</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Manfred Morgner</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-280</link>
		<author>Manfred Morgner</author>
		<pubDate>Sun, 10 Dec 2006 16:11:11 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-280</guid>
					<description>&lt;p&gt;The &#8216;pur CSS solution&#8217; does not separate the content from te layout! Therefore, this way only hides the &#8216;Old Style Problem&#8217;.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The &#8216;pur CSS solution&#8217; does not separate the content from te layout! Therefore, this way only hides the &#8216;Old Style Problem&#8217;.</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: Voyagerfan5761</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-285</link>
		<author>Voyagerfan5761</author>
		<pubDate>Tue, 23 Jan 2007 02:20:39 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-285</guid>
					<description>&lt;p&gt;Ah!  Wonderful, especially since I already had jQuery for sortable tables.  Two lines, a little modification to the CSS stylesheet, and BOOM!  Thanks a lot!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ah!  Wonderful, especially since I already had jQuery for sortable tables.  Two lines, a little modification to the CSS stylesheet, and BOOM!  Thanks a lot!</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: mediavrog</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-1073</link>
		<author>mediavrog</author>
		<pubDate>Sat, 07 Jul 2007 13:09:16 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-1073</guid>
					<description>&lt;p&gt;Well as this JS method being not unobstrusive i don't like this approach and would prefer a pure css solution like Roger Johanssons.
Another question: what if the pathname ends with an anchor tag like #myanchor - will the a href still match the location.pathname?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Well as this JS method being not unobstrusive i don't like this approach and would prefer a pure css solution like Roger Johanssons.<br />
Another question: what if the pathname ends with an anchor tag like #myanchor - will the a href still match the location.pathname?</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: jim</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-1123</link>
		<author>jim</author>
		<pubDate>Tue, 10 Jul 2007 15:40:29 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-1123</guid>
					<description>&lt;p&gt;Here's an idea I was playing with.... I wanted this to work for subpages of a site as well. This pulls of the first folder of the link: (sitename.com/firstfolder/subpage/ would check for firstfolder only)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
$(function(){ if (location.pathname.substring(1))
  $('#mainlinks a[@href*="' + location.pathname.substring(1,location.pathname.indexOf("/",1)) + '"]')
    .attr('class', 'selected')
});
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>Here's an idea I was playing with.... I wanted this to work for subpages of a site as well. This pulls of the first folder of the link: (sitename.com/firstfolder/subpage/ would check for firstfolder only)</p>
<pre><code>
$(function(){ if (location.pathname.substring(1))
  $('#mainlinks a[@href*="' + location.pathname.substring(1,location.pathname.indexOf("/",1)) + '"]')
    .attr('class', 'selected')
});
</code></pre>
]]></content:encoded>
				</item>
	<item>
		<title>By: Roman</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-1195</link>
		<author>Roman</author>
		<pubDate>Sat, 14 Jul 2007 22:58:01 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-1195</guid>
					<description>&lt;p&gt;Hello! Great idea! But how about second and third level menus?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hello! Great idea! But how about second and third level menus?</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: brwalias</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-4683</link>
		<author>brwalias</author>
		<pubDate>Mon, 29 Oct 2007 22:05:18 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-4683</guid>
					<description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I'm new to JQuery but love the simplicity of it and love working with it so far.  How would I go about highlighting 2 navigation areas on a page if I have a main and subnav?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I'm new to JQuery but love the simplicity of it and love working with it so far.  How would I go about highlighting 2 navigation areas on a page if I have a main and subnav?</p>
]]></content:encoded>
				</item>
	<item>
		<title>By: francesco</title>
		<link>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-7194</link>
		<author>francesco</author>
		<pubDate>Fri, 21 Dec 2007 17:39:42 +0000</pubDate>
		<guid>http://leftlogic.com/lounge/articles/auto-selecting_navigation/#comment-7194</guid>
					<description>&lt;p&gt;hi ,
everybody. I am trying to make work your great script but without success...maybe because I have applied the id to a div tag instead of a ul tag? can you please give me a working demo using javascript? (I have also tried with jquery but nothing changes...) 
my attempts can be seen here:
http://www.viabenedicti.it/en
if you click on Places of worship and choose a submenu item it should become red...but the class active is not applied...  :( thanx a lot!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>hi ,<br />
everybody. I am trying to make work your great script but without success...maybe because I have applied the id to a div tag instead of a ul tag? can you please give me a working demo using javascript? (I have also tried with jquery but nothing changes...)<br />
my attempts can be seen here:<br />
http://www.viabenedicti.it/en<br />
if you click on Places of worship and choose a submenu item it should become red...but the class active is not applied...  :( thanx a lot!</p>
]]></content:encoded>
				</item>
</channel>
</rss>
