Skip to content

Commit

Permalink
Add active class to the currently active tab content, as well as the …
Browse files Browse the repository at this point in the history
…tab itself

If this is not done, then the active class remains on the tab that was initially visible on page load - even if this tab is now hidden and no longer active. This is confusing when trying to target CSS as a the selector "ul.tabs-content > li.active" , may not be visible.

Also removed unused tabsContent variable.
  • Loading branch information
LoonyPandora committed Jun 8, 2011
1 parent 0eed0f8 commit 8b05d2b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions javascripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ $(document).ready(function() {

/* Tabs Activiation
================================================== */
var tabs = $('ul.tabs'),
tabsContent = $('ul.tabs-content');
var tabs = $('ul.tabs');

tabs.each(function(i) {
//Get all tabs
Expand All @@ -32,8 +31,8 @@ $(document).ready(function() {
tab.removeClass('active');
$(this).addClass('active');

//Show Tab Content
$(contentLocation).show().siblings().hide();
//Show Tab Content & add active class
$(contentLocation).show().addClass('active').siblings().hide().removeClass('active');

}
});
Expand Down

0 comments on commit 8b05d2b

Please sign in to comment.