Show tab with url
<p>I wrote a code that whould change a li's class to active and show the correct content on click but I also would like to be able to link a visitor to example: www.socal.nu/index.php#tab2 to activate tab2.</p>

<p>Code:</p>

<pre><code>$(document).ready(function() {

//Default Action
$(".tab_content").hide();
$("ul.tabs li:first").addClass("active").show();
$(".tab_content:first").show();

//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active");
$(this).addClass("active");
$(".tab_content").hide();
var activeTab = $(this).find("a").attr("href");
$(activeTab).fadeIn();
return false;
});

});
</code></pre>

<p>Edited to include the (x)html structure of the tabs list (as posted by the OP in a comment to <a href="http://stackoverflow.com/questions/3167206/show-tab-with-url/3167423#3167423">@slightlymore's answer</a>):</p>

<pre><code>&lt;ul class="tabs"&gt;
  &lt;li&gt;&lt;a href="#tab1"&gt;Hem&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#tab2"&gt;Projekt&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#tab3"&gt;Om SOCAL&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#tab4"&gt;Kontakt&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>
