diff --git a/javascripts/app.js b/javascripts/app.js index 38fb78a..98f6374 100644 --- a/javascripts/app.js +++ b/javascripts/app.js @@ -15,13 +15,24 @@ $(document).ready(function() { ================================================== */ var tabs = $('ul.tabs'); + /* hide tab content. Doing this with JS + makes the tabs work when JS is enabled but + CSS is not, an interesting accessibility + edge case. Ensures that "active" is respected. + */ + $("ul.tabs-content > li").each(function(t){ + if(!$(this).hasClass("active")){ + $(this).hide(); + }; + }); + tabs.each(function(i) { //Get all tabs var tab = $(this).find('> li > a'); tab.click(function(e) { //Get Location of tab's content - var contentLocation = $(this).attr('href') + "Tab"; + var contentLocation = $(this).attr('href'); //Let go if not a hashed one if(contentLocation.charAt(0)=="#") { diff --git a/stylesheets/base.css b/stylesheets/base.css index 0496b54..e3c2cfc 100644 --- a/stylesheets/base.css +++ b/stylesheets/base.css @@ -254,7 +254,6 @@ border-top-right-radius: 2px; } ul.tabs-content { margin: 0; display: block; } - ul.tabs-content > li { display:none; } ul.tabs-content > li.active { display: block; } /* Clearfixing tabs for beautiful stacking */