scripts.js
1.5 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// common scripts
(function() {
"use strict";
// Sidebar toggle
jQuery('.menu-list > a').click(function() {
var parent = jQuery(this).parent();
var sub = parent.find('> ul');
if(!jQuery('body').hasClass('sidebar-collapsed')) {
if(sub.is(':visible')) {
sub.slideUp(300, function(){
parent.removeClass('nav-active');
jQuery('.body-content').css({height: ''});
adjustMainContentHeight();
});
} else {
visibleSubMenuClose();
parent.addClass('nav-active');
sub.slideDown(300, function(){
adjustMainContentHeight();
});
}
}
return false;
});
function visibleSubMenuClose() {
jQuery('.menu-list').each(function() {
var t = jQuery(this);
if(t.hasClass('nav-active')) {
t.find('> ul').slideUp(300, function(){
t.removeClass('nav-active');
});
}
});
}
function adjustMainContentHeight() {
// Adjust main content height
var docHeight = jQuery(document).height();
if(docHeight > jQuery('.body-content').height())
jQuery('.body-content').height(docHeight);
}
// add class mouse hover
jQuery('.side-navigation > li').hover(function(){
jQuery(this).addClass('nav-hover');
}, function(){
jQuery(this).removeClass('nav-hover');
});
})(jQuery);