-
Notifications
You must be signed in to change notification settings - Fork 13
/
admin_sidebar.php
102 lines (70 loc) · 2.21 KB
/
admin_sidebar.php
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="admin_sidebar_style.css">
</head>
<body>
<div class="sidenav" id="theSideNav">
<a href="javascript:void(0)" id="closebtn" onclick="closeNav()">×</a>
<a href="admin_home.php">Home</a>
<a id="label">My Customers</a>
<a href="customer_add.php">Add Customer</a>
<a href="manage_customers.php">Manage Customers</a>
<a id="label">Website Management</a>
<a href="post_news.php">Post News</a>
</div>
<script>
// Helps in recognizing which tab is selected.
for (var i = 0; i < document.links.length; i++) {
if (document.URL.indexOf('?') > 0)
{
sanitizedURL = document.URL.substring(0, document.URL.indexOf('?'));
}
else {
sanitizedURL = document.URL;
}
if (document.links[i].href == sanitizedURL) {
document.links[i].className = 'active';
}
}
function openNav() {
document.getElementById("theSideNav").style.width = "256px";
var x = document.getElementById("theSideNav");
if (x.className === "sidenav sidenav-fixed") {
x.className += " responsive";
}
}
function closeNav() {
if (document.documentElement.clientWidth < 856) {
document.getElementById("theSideNav").style.width = "0";
}
}
$(document).ready(function() {
$(window).resize(function () {
if ($(window).width() > 855)
document.getElementById("theSideNav").style.width = "256px";
if (($(window).width()) < 856){
$('#closebtn').trigger('click');
}
});
});
// Function below is jquery-3 function used for making the navbar sticky
$(document).ready(function()
{
$(window).scroll(function () {
var x1 = document.getElementById("theSideNav").style.width;
if ($(window).scrollTop() > 120) {
$("#theSideNav").addClass('sidenav-fixed');
if (($(window).width()) < 856 && x1 == "256px") {
$('#hamburger').trigger('click');
}
}
if ($(window).scrollTop() < 121) {
$("#theSideNav").removeClass('sidenav-fixed');
}
});
});
</script>
</body>
</html>