-
Notifications
You must be signed in to change notification settings - Fork 13
/
customer_sidebar.php
98 lines (70 loc) · 2.39 KB
/
customer_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
<!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" style="padding: 10px 20px;"
onclick="closeNav()">×</a>
<a href="customer_home.php">Home</a>
<a href="customer_transactions.php">My Transactions</a>
<a id="label">Send/Recieve</a>
<a href="beneficiary.php">Transfer Funds</a>
<a href="atm_simulator.php">ATM Simulator</a>
</div>
<script>
// For-Loop below is used to create active links and accordingly color them.
// 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";
}
}
// Never use get window size of jquery, in javascript, they dont work !
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>