Created
July 15, 2013 04:02
-
-
Save joshuapaling/5997421 to your computer and use it in GitHub Desktop.
Super Simple JQuery Tabs
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
function setUpTabs($tabContainer){ | |
$('.tab_links a', $tabContainer).click(function(){ | |
$('.tab_content', $tabContainer).hide(); | |
$('.tab_links a', $tabContainer).removeClass('current'); | |
$(this).addClass('current'); | |
var tabId = $(this).attr('href'); | |
//tabId = tabId.substr(1); // stip of the # from the front | |
window.location.hash = tabId; | |
$(tabId).show(); | |
return false; | |
}); | |
$firstTab = $('.tab_links a', $tabContainer).first(); | |
$('.tab_content', $tabContainer).hide(); | |
$firstTab.trigger('click'); | |
} | |
setUpTabs($('.my_tabs_container')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment