-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
66 lines (58 loc) · 2.45 KB
/
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
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
var loader = document.getElementById("loader");
var blacker = document.getElementById("container");
var body = document.getElementsByTagName("body");
function onloadFunction() {
loader.style.animation = "none";
blacker.style.display = "none";
};
var bar = document.getElementById('bar');
window.addEventListener("scroll", function () {
if (window.scrollY > 0) {
bar.style.position = "fixed";
bar.style.boxShadow = "-1px 3px 16px 1px black";
bar.style.border = "none";
}
else{
bar.style.position = "";
bar.style.boxShadow = "";
bar.style.border = "";
}
});
function resize() {
var w = document.documentElement.clientWidth;
var h1 = w * 1329 / 1999;
var i1 = document.getElementById('jungleImg');
i1.style.transform = "scale(" + (w / 1999) + ")";
i1.style.left = w / 2 - 999.5;
i1.style.top = h1 / 2 - 1329 / 2;
var h2 = w * 1412 / 2000;
var i2 = document.getElementById('roadImg');
i2.style.transform = "scale(" + (w / 2000) + ")";
i2.style.left = w / 2 - 1000;
i2.style.top = h2 / 2 - 1412 / 2;
var h3 = w * 1412 / 1916;
var i3 = document.getElementById('IntrumentsGenImg');
i3.style.transform = "scale(" + (w / 1916) + ")";
i3.style.left = w / 2 - 1916 / 2;
i3.style.top = h3 / 2 - 1412 / 2;
}
resize();
window.addEventListener('resize', resize, true);
var gameBtn = document.getElementsByClassName("game");
for (var x = 0; x < gameBtn.length; x++) {
gameBtn[x].addEventListener("click", function () {
console.log(this);
document.getElementById(this.getAttribute("jumpTo")).scrollIntoView({
behavior: "smooth"
});
});
}
var items = document.getElementsByTagName('area');
var aud = document.getElementsByTagName('audio')[0];
var audsrc = document.getElementById('audsrc');
for (var x = 0; x < items.length; x++) {
items[x].addEventListener("click", function () {
aud.src = "audio/" + this.getAttribute("title") + ".mp3";
aud.play();
});
}