-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathml.html
76 lines (43 loc) · 1.13 KB
/
ml.html
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
<!DOCTYPE html>
<html>
<head>
<title> Project </title>
<link rel="stylesheet" type="text/css" href="ml.css">
</head>
<body>
<div class="wrapper">
<h1> Welcome </h1>
<button class="accordion" type="button"> Sec1 </button>
<div class="panel">
<p> Hello World !
</p>
</div>
<button class="accordion" type="button"> Sec2 </button>
<div class="panel">
<p> Hello World !
</p>
</div>
<button class="accordion" type="button"> Sec3 </button>
<div class="panel">
<p> Hello World !
</p>
</div>
</div>
<script>
var acc = document.getElementsByClassName("accordion");
var i;
for(i = 0;i<acc.length; i++) {
acc[i].onclick = function(){
this.classList.toggle("active");
var panel = this.nextElementSibling;
if(panel.style.maxHeight){
panel.style.maxHeight = null;
}
else{
panel.style.maxHeight = panel.scrollHeight + "px";
}
}
}
</script>
</body>
</html>