-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcontacts_section.js
27 lines (24 loc) · 1.08 KB
/
contacts_section.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
contact_bg = document.querySelector('.contacts');
window.addEventListener('scroll', function() {
if ((this.window.scrollY / this.window.innerHeight) < 9) {
contact_bg.style.width = '98vw';
contact_bg.style.height = '98vh';
contact_bg.style.borderRadius = '2vw';
contact_bg.style.margin = '1vh 1vw';
}
else if ((this.window.scrollY / this.window.innerHeight) >10) {
contact_bg.style.width = '100vw';
contact_bg.style.height = '100vh';
contact_bg.style.borderRadius = '0vw';
contact_bg.style.margin = '0vh 0vw';
}
else {
width = (((this.window.scrollY / this.window.innerHeight) - 9)*2) + 98;
left = 1-(((this.window.scrollY / this.window.innerHeight) - 9))
borderRadius = 2 - (((this.window.scrollY / this.window.innerHeight) - 9)*2);
contact_bg.style.width = width + 'vw';
contact_bg.style.height = width + 'vh';
contact_bg.style.margin = left + 'vh ' + left + 'vw';
contact_bg.style.borderRadius = + borderRadius + 'vw';
}
})