- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdding_&_Removing_Classes.html
More file actions
Latest commit
92 lines (84 loc) · 3.07 KB
/
Copy pathAdding_&_Removing_Classes.html
File metadata and controls
92 lines (84 loc) · 3.07 KB
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
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8" />
<metaname="viewport" content="width=device-width, initial-scale=1.0" />
<title>🏴‍☠️ Complete Javascripts Course</title>
<linkhref="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous" />
<style>
.box1 {
background-color: aqua;
font-size:1.5em;
color:#fff;
}
.box2 {
background-color: red;
font-size:0.5em;
color:#ddd;
}
#one,
#two,
#three {
width:100px;
height:100px;
display: inline-block;
border:2px solid black;
border-radius:15px;
padding:5px0px;
border-left-color: pink;
border-top-color: orange;
border-right-color: red;
border-bottom-style: dashed;
}
.active {
background-color: purple;
}
</style>
</head>
<body>
<br/>
<br/>
<center>
<!-- <input type="text" id="item"> -->
<br/>
<divid="wrapper">📃 🏪 👾</div>
<br/>
<divid="one" class="myClass">Box One</div>
<divid="two" class="myClass active">Box Two</div>
<divid="three" class="myClass">Box Three</div>
<divid="one" class="myClass">Box Four</div>
<divid="two" class="myClass active">Box Five</div>
<divid="three" class="myClass">Box Six</div>
<divid="one" class="myClass">Box Seven</div>
<divid="two" class="myClass active">Box Eight</div>
<divid="three" class="myClass">Box Nine</div>
<divid="one" class="myClass">Box Ten</div>
<divid="two" class="myClass active">Box Eleven</div>
<divid="three" class="myClass">Box Twelve</div>
<br><br><br>
<ahref="./JavaScript_Accordian.html"><buttontype="button" class="btn btn-outline-warning">JavaScript_Accordian</button></a>
</center>
<script>
varel=document.querySelectorAll('.myClass');
for(varx=0;x<el.length;x++){
el[x].onclick=function(){
upClass(el,'active','remove');
if(!this.classList.contains('active')){
this.classList.add('active');
}
// this.classList.toggle('box1');
}
}
functionupClass(e,c,a){
for(varx=0;x<e.length;x++){
e[x].classList[a](c);
}
}
</script>
<scriptsrc="https://code.jquery.com/jquery-3.5.0.js"
integrity="sha256-r/AaFHrszJtwpe+tHyNi/XCfMxYpbsRg2Uqn0x3s2zc=" crossorigin="anonymous"></script>
<scriptsrc="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<scriptsrc="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
</body>
</html>