-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.js
55 lines (34 loc) · 1.11 KB
/
home.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
var name;
$(document).ready(function(){
const audio = document.querySelector("audio");
audio.volume = 0.2;
audio.loop = true;
audio.play();
$("#player").html(localStorage["name"]);
$("#save").click(function() {
name = $("#input-name").val();
localStorage.setItem("name", name);
$("#player").html(localStorage["name"]);
});
localStorage["score"] = 0;
// colour change on hover
$("button").mouseenter(function() {
$(this).css("background-color","#d1d1e0");
});
$("button").mouseleave(function() {
$(this).css("background-color","#f0f0f5");
});
// setting 1st question as currentQuestion for each level
$("#test").click(function() {
localStorage.setItem("level","test");
});
$("#easy").click(function() {
localStorage.setItem("level","easy");
});
$("#medium").click(function() {
localStorage.setItem("level","medium");
});
$("#hard").click(function() {
localStorage.setItem("level","hard");
});
});