Created
February 20, 2010 03:27
-
-
Save mraichelson/309477 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 the link contains an # | |
if(theLinkUrl.indexOf('#') != -1){ | |
// check if the # is on the same page (blank in !IE, doc.location in IE) | |
if( theLinkUrl.split('#')[0] == '' || theLinkUrl.split('#')[0] == document.location ){ | |
// when clicking the link, trigger the link in ul.tabs that links to the same ID | |
$j(this).bind( | |
'click', | |
function(){ | |
$j('ul.tabs>li a[href="#'+theLinkUrl.split('#')[1]+'"]').trigger('click'); | |
// kill focus on the link and cancel the attempted clickthrough | |
this.blur(); | |
return false; | |
} | |
); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment