-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.html
56 lines (49 loc) · 1.71 KB
/
settings.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Streetracers</title>
<link rel="stylesheet" href="media/css/style.css">
<style>
</style>
</head>
<body>
<section id="start">
<div class="containerStart">
<div class="menu">
<h1>Streetracers</h1>
<div class="button-container">
<button class="button button-play" id="homeButton">Home</button>
</div>
<div class="volume-container">
<label for="volume">Volume: </label>
<input type="range" id="volume" min="0" max="1" step="0.1" value="0.5">
</div>
</div>
</div>
</section>
<script src="media/js/script.js"></script>
<script>
const volumeSlider = document.getElementById('volume');
const homeButton = document.getElementById('homeButton');
const savedVolume = localStorage.getItem('gameVolume');
if (savedVolume) {
volumeSlider.value = savedVolume;
setVolume(savedVolume);
}
volumeSlider.addEventListener('input', (event) => {
const volume = event.target.value;
setVolume(volume);
localStorage.setItem('gameVolume', volume);
});
function setVolume(volume) {
console.log(`Volume set to: ${volume}`);
}
// Event listener for home button
homeButton.addEventListener('click', () => {
window.location.href = 'index.html';
});
</script>
</body>
</html>