forked from AIT-Website/aitpune
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clubs.js
58 lines (52 loc) · 1.43 KB
/
clubs.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
var card = null;
function changeStyle(element) {
applyStyles(element);
var name = element.innerHTML;
if(name=='About'){
hidecontent("but1", element);
}
else if(name=='Coordinator'){
hidecontent("but2", element);
}
else if(name=='Activities') {
hidecontent("but3", element);
}
}
function applyStyles(element) {
card = element.closest(".clubcard");
buttons = card.querySelectorAll("#but12");
buttons.forEach((button)=>{
button.style.background = "#FFF";
button.style.color = "#4C6BF1";
})
element.style.background = "#4C6BF1";
element.style.color = "#FFF";
prevClicked = element;
}
prevClicked = document.querySelector('.butclub1');
applyStyles(prevClicked);
function hidecontent(eleid, element){
const allco = card.querySelectorAll('.clubcontent');
allco.forEach((cont)=>{
let currid=cont.getAttribute('id');
if(currid===eleid){
console.log(currid);
cont.style.display="block";
}else{
cont.style.display='none';
}
})
}
function hideallcontent(eleid){
const allco = document.querySelectorAll('.clubcontent');
allco.forEach((cont)=>{
let currid=cont.getAttribute('id');
if(currid===eleid){
console.log(currid);
cont.style.display="block";
}else{
cont.style.display='none';
}
})
}
hideallcontent("but1");