Skip to content

Instantly share code, notes, and snippets.

@mraichelson
Created March 11, 2010 16:45
Show Gist options
  • Save mraichelson/329326 to your computer and use it in GitHub Desktop.
Save mraichelson/329326 to your computer and use it in GitHub Desktop.
// find embedded links to other tabs and trigger tab behavior when they are clicked.
$j('div.tabContent a').each(function(i){
var theLinkUrl = $j(this).attr('href');
if(theLinkUrl.indexOf('#') != -1){
if( theLinkUrl.split('#')[0] == '' || theLinkUrl.split('#')[0] == document.location ){
$j(this).bind(
'click',
function(){
if($j('ul.tabs a[href="#'+theLinkUrl.split('#')[1]+'"]').size()>0){
$j('ul.tabs>li a[href="#'+theLinkUrl.split('#')[1]+'"]').trigger('click');
this.blur();
return false;
}
}
);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment