forked from Technigo/project-business-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
32 lines (14 loc) · 780 Bytes
/
script.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
// A function that adds and remove the class "active" on the section you click on.
// We haven't really talked about ´this´ yet, but we will... ;)
// console.log(this) to see how it works
// Selects an HTML element, and calls a function which will be executed when the element is clicked.
document.getElementById('question1').onclick = toggleMagic
document.getElementById('question2').onclick = toggleMagic
document.getElementById('question3').onclick = toggleMagic
document.getElementById('question4').onclick = toggleMagic
document.getElementById('question5').onclick = toggleMagic
document.getElementById('question6').onclick = toggleMagic
document.getElementById('question7').onclick = toggleMagic
function toggleMagic(){
this.classList.toggle('open')
}