main.js
2.22 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//Main JS file; here is the JS needed for all the pages/subpages
$("table").addClass('table table-bordered table-striped');
$("p").addClass('editable');
$("img").addClass('img-responsive');
//Sidebar dropdown; it allows sub-menus to drop on click
( function( $ ) {
$( document ).ready(function() {
$('#sidebar-wrapper ul ul li:odd').addClass('odd');
$('#sidebar-wrapper ul ul li:even').addClass('even');
$('#sidebar-wrapper > ul > li > a').click(function() {
var checkElement = $(this).next();
if ($(this).closest('li').hasClass('active') && (checkElement.is('ul')) && (checkElement.is(':visible')) && (checkElement.closest('li').has('#sub-active') ))
{
$(checkElement).slideUp('normal');
return false;
};
$('#sidebar-wrapper li').removeClass('active');
$(this).closest('li').addClass('active');
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
$(this).closest('li').removeClass('active');
checkElement.slideUp('normal');
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#sidebar-wrapper ul ul:visible').slideUp('normal');
checkElement.slideDown('normal');
}
if($(this).closest('li').find('ul').children().length == 0) {
return true;
} else {
return false;
}
});
});
} )( jQuery );
//menu-toggle
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
$(".sidebar-link").click(function() {
var viewportwidth;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined')
{
viewportwidth = window.innerWidth
}
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth !=
'undefined' && document.documentElement.clientWidth != 0)
{
viewportwidth = document.documentElement.clientWidth
}
// older versions of IE
else
{
viewportwidth = document.getElementsByTagName('body')[0].clientWidth
}
if (viewportwidth < 1200)
$("#wrapper").toggleClass("toggled");
});