-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
58 lines (53 loc) · 1.57 KB
/
index.js
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
$("#dropbtn").click(function () {
// Change background color of nav items on click
$("#myDropdown").toggle(75, function () {
if($("#myDropdown").is(":visible")){
$("#dropbtn").css("background-color", "#555555");
} else{
$("#dropbtn").css("background-color", "black");
}
});
});
//On reload
var windowWidth = $(window).width();
if(windowWidth < 1080){
$("#desktop-navbar").hide();
$("#mobile-navbar").show();
}
else{
$("#desktop-navbar").show();
$("#mobile-navbar").hide();
}
// Function to make the website responsive
window.addEventListener('resize', function () {
var windowWidth = $(window).width();
if(windowWidth < 1080){
$("#desktop-navbar").hide();
$("#mobile-navbar").show();
}
else{
$("#desktop-navbar").show();
$("#mobile-navbar").hide();
$("#menu-overlay").hide();
}
});
// To toogle menu overlay in mobile mode
$("#menu-btn").click(function () {
if($("#menu-overlay").is(":visible")){
$("#menu-overlay").slideUp(100);
$("#menu-btn").css("background-color", "black");
$("#menu-btn").html("<i class='fa-solid fa-bars'></i>")
} else{
$("#menu-overlay").slideDown(100);
$("#menu-btn").css("background-color", "#555555");
$("#menu-btn").html("<i class='fa-solid fa-xmark'></i>")
}
})
$("#overlay-dropdown").click(function () {
if($("#overlay-comp-list").is(":visible")){
$("#overlay-comp-list").slideUp(100);
}
else{
$("#overlay-comp-list").slideDown(100);
}
})