-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
22 lines (18 loc) · 767 Bytes
/
script.js
File metadata and controls
22 lines (18 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const title = document.getElementById('title');
const flag1 = document.getElementById('flag1');
const flag2 = document.getElementById('flag2');
const city = document.getElementById('city');
const cloud = document.getElementById('cloud');
const mount = document.getElementById('mount');
const code1 = document.querySelector('.code1')
const code2 = document.querySelector('.code2')
document.addEventListener('scroll', function() {
let value = window.scrollY
console.log(value)
title.style.marginTop = value * 1.2 + 'px'
flag1.style.marginLeft = -value + 'px'
flag2.style.marginLeft = value + 'px'
city.style.marginBottom = -value + 'px'
cloud.style.marginBottom = -value * 1.1 + 'px'
mount.style.marginBottom = -value * 1.2 + 'px'
})