gunicorn/docs/site/js/main.js
Prateek Singh Paudel f6e2fbc935 Add new website.
Older html is modified with redirect code to redirect to relevant
part in newsite or docs. So, someone linking to us will still work.
2012-10-04 00:43:15 +05:45

46 lines
1.4 KiB
JavaScript
Executable File

$(document).ready(function() {
Tabs.init();
});
var Tabs = {
init: function(){
var activateTab = function ($tab) {
var // this links tabs set
$tabs = $tab.parents('.tabs'),
// currently active tab
activeTab = {
'tab' : $tabs.find('ul').children('li.active'),
'content' : $tabs.find('div[data-tab].active')
},
// newly clicked tab
newTab = {
'tab' : $tab.parent('li'),
'content' : $tabs.find('[data-tab=' + $tab.attr('href').replace('#', '') + ']')
},
x, y;
// remove active class from tab and content
for (x in activeTab) {
activeTab[x].removeClass('active');
}
// add active class to tab and content
for (y in newTab) {
newTab[y].addClass('active');
}
};
// hook up tab links
$(document).on('click', '.tabs ul li a', function(e) {
activateTab($(this));
//alert($(this));
});
// hook up initial load active tab
if (window.location.hash) {
var $activeTab = $('a[href="' + window.location.hash + '"]');
if ($activeTab.length && $activeTab.parents('.tabs').length) {
activateTab($activeTab);
}
}
}
};