-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
40 lines (32 loc) · 1.2 KB
/
Copy pathapp.js
File metadata and controls
40 lines (32 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(function($) {
function init() {
/* Sidebar height set */
$sidebarStyles = $('.sidebar').attr('style') || "";
$sidebarStyles += ' min-height: ' + $(document).height() + 'px;';
$('.sidebar').attr('style', $sidebarStyles);
/* Secondary contact links */
var $scontacts = $('#contact-list-secondary');
var $contactList = $('#contact-list');
$scontacts.hide();
$contactList.mouseenter(function(){ $scontacts.fadeIn(); });
$contactList.mouseleave(function(){ $scontacts.fadeOut(); });
/**
* Tags & categories tab activation based on hash value. If hash is undefined then first tab is activated.
*/
function activateTab() {
if(['/tags.html', '/categories.html'].indexOf(window.location.pathname) > -1) {
var hash = window.location.hash;
if(hash)
$('.tab-pane').length && $('a[href="' + hash + '"]').tab('show');
else
$('.tab-pane').length && $($('.cat-tag-menu li a')[0]).tab('show');
}
}
// watch hash change and activate relevant tab
$(window).on('hashchange', activateTab);
// initial activation
activateTab();
};
// run init on document ready
$(document).ready(init);
})(jQuery);