File tree Expand file tree Collapse file tree 2 files changed +47
-3
lines changed Expand file tree Collapse file tree 2 files changed +47
-3
lines changed Original file line number Diff line number Diff line change 1
1
const hobbies = document . getElementsByClassName ( "hobbies" ) ;
2
+ const clubs = document . getElementsByClassName ( "clubs" ) ;
2
3
const swenList = document . querySelector ( "ul.swen_list" ) ;
3
4
var info = document . createElement ( "li" ) ;
4
5
info . textContent = "Click here to add a new list item" ;
5
6
swenList . appendChild ( info ) ;
6
7
7
8
for ( var index = 0 ; index < hobbies . length ; index ++ ) {
8
9
hobbies [ index ] . addEventListener ( "click" , async function ( ) {
9
- this . classList . toggle ( "active " ) ;
10
+ this . classList . toggle ( "hobbies_active " ) ;
10
11
var content = this . nextElementSibling ;
11
12
12
13
if ( content . style . maxHeight ) {
@@ -19,6 +20,22 @@ for (var index = 0; index < hobbies.length; index++) {
19
20
} ) ;
20
21
}
21
22
23
+ for ( var index = 0 ; index < clubs . length ; index ++ ) {
24
+ clubs [ index ] . addEventListener ( "click" , async function ( ) {
25
+ this . classList . toggle ( "clubs_active" ) ;
26
+ var content = this . nextElementSibling ;
27
+
28
+ if ( content . style . maxHeight ) {
29
+ content . style . maxHeight = null ;
30
+ }
31
+
32
+ else {
33
+ content . style . maxHeight = content . scrollHeight + "px" ;
34
+ }
35
+ } ) ;
36
+ }
37
+
38
+
22
39
info . onclick = async function ( ) {
23
40
const listItem = document . createElement ( "li" ) ;
24
41
const listContent = prompt ( "Enter a list item: " ) ;
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ main > :not(hr), footer {
75
75
.about_me img {
76
76
float : right;
77
77
border : 2px solid # 333 ;
78
- margin-left : 10 px ;
78
+ margin-left : 20 px ;
79
79
margin-bottom : 30px ;
80
80
max-width : 20% ;
81
81
height : auto;
@@ -93,9 +93,10 @@ main > :not(hr), footer {
93
93
content : '\002B Hobbies' ;
94
94
font-weight : bold;
95
95
font-size : 22px ;
96
+ margin-bottom : 0px ;
96
97
}
97
98
98
- .active : after {
99
+ .hobbies_active : after {
99
100
content : '\2212 Hobbies' ;
100
101
}
101
102
@@ -111,6 +112,32 @@ main > :not(hr), footer {
111
112
margin-right : 10% ;
112
113
}
113
114
115
+ .clubs {
116
+ background-color : transparent;
117
+ border-width : 0 ;
118
+ font-family : inherit;
119
+ font-style : inherit;
120
+ margin-left : 20px ;
121
+ margin-top : 30px ;
122
+ }
123
+
124
+ .clubs : after {
125
+ content : '\002B Clubs' ;
126
+ font-weight : bold;
127
+ font-size : 22px ;
128
+ }
129
+
130
+ .clubs_active : after {
131
+ content : '\2212 Clubs' ;
132
+ }
133
+
134
+ # clubs_content {
135
+ line-height : 25px ;
136
+ max-height : 0 ;
137
+ overflow : hidden;
138
+ transition : max-height 0.2s ease-out;
139
+ }
140
+
114
141
.schedule table {
115
142
border : 2px solid black;
116
143
background-color : rgb (211 , 234 , 250 )
You can’t perform that action at this time.
0 commit comments