forked from avinash201199/Portfolio-Collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
56 lines (47 loc) · 1.58 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
function Page(evt, tabName) {
// Declare all variables
let i, SlideContent, Btn;
// Get all elements with class="tabcontent" and hide them
SlideContent = document.getElementsByClassName("SlideContent");
for (i = 0; i < SlideContent.length; i++) {
SlideContent[i].style.display = "none";
}
// Get all elements with class="tablinks" and remove the class "active"
Btn = document.getElementsByClassName("Btn");
for (i = 0; i < Btn.length; i++) {
Btn[i].className = Btn[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getElementById(tabName).style.display = "";
evt.currentTarget.className += " active";
}
document.getElementById("DefaultOpen").click();
//Disables right click
document.addEventListener(
"contextmenu",
function (event) {
event.preventDefault();
},
false
);
// NAVIGATION MENU JS
const mainMenu = document.querySelector('.mainMenu');
const closeMenu = document.querySelector('.closeMenu');
const openMenu = document.querySelector('.openMenu');
const NavBtn = document.querySelectorAll('.Btn');
openMenu.addEventListener('click', show);
closeMenu.addEventListener('click', close);
// NavBtn.addEventListener('click' , close);
// close menu when you click on a menu item
NavBtn.forEach(item => {
item.addEventListener('click',function(){
close();
})
})
function show(){
mainMenu.style.display = 'flex';
mainMenu.style.top = '-2px';
}
function close(){
mainMenu.style.top = '-113%';
}