so I have this code for tabs in jquery, the href is set to about, what I want to do is provide a link in the menu that triggers this tab when clicked so http://myurl.com#about
$('#info-nav li').click(function(e) {
$('#info div').hide();
$('#info-nav .current').removeClass("current");
$(this).addClass('current');
var clicked = $(this).find('a:first').attr('href');
$('#info ' + clicked).fadeIn('fast');
e.preventDefault();
}).eq(0).addClass('current');
I would attach the handler to
<a>element instead of<li>so that on
DOMreadyevent I would read the hash in the URL (withlocation.hash) and I would trigger theclickevent (or the handler with.triggerHandler()) on the element whose href attribute is equal to that hashcall the same function on
window.onhashchangeevent (if the link you’re providing is not actually changing the whole page)