Skip to content

Instantly share code, notes, and snippets.

@venomjke
Created April 5, 2014 11:54
Show Gist options
  • Save venomjke/9991023 to your computer and use it in GitHub Desktop.
Save venomjke/9991023 to your computer and use it in GitHub Desktop.
function calcLastTabHeight ($tabs, $currentTabContent) {
$tabs.find('.last-tab').css('height', 0);
var contentHeight = $currentTabContent.outerHeight();
var tabsHeight = $tabs.outerHeight();
var transTabHeight = contentHeight - tabsHeight;
$tabs.find('.last-tab').css('height', transTabHeight);
}
function hideTabsContent ($tabBox) {
$tabBox.find('.tab-content').each(function(){
$(this).hide();
})
}
function transparentTabs ($tabBox) {
var $tabs = $tabBox.find('.tabs');
var $currentTab = $tabs.find('.active');
var $tabsContent = $tabBox.find('.tab-content');
hideTabsContent($tabBox);
$tabs.find('a').click(function(event){
event.preventDefault();
hideTabsContent($tabBox);
$tabs.find('a').removeClass('active');
$currentTab = $(this);
$currentTab.addClass('active');
$currentTabContent = $tabBox.find($currentTab.attr('href'));
$currentTabContent.show();
calcLastTabHeight($tabs, $currentTabContent);
})
}
$(function(){
transparentTabs($('.tabs-obox'));
$('.tabs > div > a').first().click();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment