-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.js
More file actions
74 lines (51 loc) · 2.02 KB
/
action.js
File metadata and controls
74 lines (51 loc) · 2.02 KB
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
67
68
69
70
71
72
73
74
// Select the class bubble
time = document.getElementsByClassName('bubbles')[0];
// padding values for desktop
var fish2move = 100;
var fish3move = 900;
var fish4move = 1200;
if (screen.width < 400) {
//Change transformation duration and translatey for mobile view
time.style.setProperty('--transform-duration', '15s')
time.style.setProperty('--transform-y', '-700vh')
// padding values for mobile
fish2move = 1680;
fish3move = 3000;
fish4move = 4300;
}
window.addEventListener('scroll', function () {
let value = window.scrollY; //Get Scroll Value (Mobile - High)
text.style.top = 50 + value * -0.2 + '%';
cloud.style.left = value * 2 + 'px';
bird1.style.top = value * 0.1 + 'px';
bird1.style.left = value * 1 + 'px';
bird2.style.top = value * -0.1 + 'px';
bird2.style.left = value * -2 + 'px';
explore.style.marginTop = value * 1.5 + 'px';
rocks.style.top = value * -0.14 + 'px';
forest.style.top = value * 0.4 + 'px';
sky.style.top = value * 0.25 + 'px';
mountains.style.top = value * 0.25 + 'px';
header.style.top = value * 0.7 + 'px';
sun.style.top = value * 1 + 'px';
//To prevent splash to move above sea water
if (value < 380) {
splash.style.top = 20 + value * -0.3 + 'px';
}
//Move fishes horizontally
fish1.style.right = (value - 100) * 1 + 'px';
fish2.style.left = (value - fish2move) * 1 + 'px';
fish3.style.right = (value - fish3move) * 1 + 'px';
fish4.style.left = (value - fish4move) * 1 + 'px';
})
// Contains the link for all social media handles
var links = document.getElementsByClassName("social-media");
links[0].addEventListener("click", () => { openlink(1) });
links[1].addEventListener("click", () => { openlink(2) });
links[2].addEventListener("click", () => { openlink(3) });
links[3].addEventListener("click", () => { openlink(4) });
function openlink(x) {
if (x == 1) {
window.open("https://www.instagram.com/_aakanksha_rajput_?igsh=MWp2Mm9ieXR1Z3Vwbw==", "_blank");
}
}