-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
73 lines (62 loc) · 2.26 KB
/
app.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
67
68
69
70
71
72
73
var v = document.querySelector('.image')
var lay1 = document.querySelector('#layer1')
var lay2 = document.querySelector('#layer2')
var lay3 = document.querySelector('#layer3')
var lay4 = document.querySelector('#layer4')
var lay5 = document.querySelector('#layer5')
var lay6 = document.querySelector('#layer6')
var lay7 = document.querySelector('#layer7')
var para = document.querySelector('.paragraph')
var mainPara = document.querySelector('.parallax')
var activeFloat = false
// window.addEventListener('scroll', function () {
// var x = this.pageYOffset;
// console.log(top)
// lay7.style.transform = `translate3d(0px,-${x * 1}px,0px)`
// console.log(x*1)
// lay6.style.transform = `translate3d(0px,-${x * 0.6}px,0px)`
// console.log(x * 0.8)
// lay5.style.transform = `translate3d(0px,-${x * 0.6}px,0px)`
// console.log(x * 0.6)
// lay4.style.transform = `translate3d(0px,-${x * 0.4}px,0px)`
// console.log(x * 0.4)
// lay3.style.transform = `translate3d(0px,-${x * 0.3}px,0px)`
// console.log(x * 0.3)
// lay2.style.transform = `translate3d(0px,-${x * 0.2}px,0px)`
// console.log(x * 0.2)
// lay1.style.transform = `translate3d(0px,-${x * 0.1}px,0px)`
// console.log(x * 0.1)
// })
window.addEventListener("scroll", function (event) {
var top = this.pageYOffset;
var layers = document.getElementsByClassName("layers");
var layer, speed, yPos;
for (var i = 0; i < layers.length; i++) {
layer = layers[i];
speed = layer.getAttribute('data-speed');
var yPos = -(top * speed / 100);
layer.setAttribute('style', 'transform: translate3d(0px, ' + yPos + 'px, 0px)');
}
if(activeFloat){
var a = 200
while(a > 0){
document.querySelector('.works a:nth-child(1)').style.transform = `translate(-${a},${a})`
a-=10;
}
}
})
var waypoint = new Waypoint({
element: document.querySelector('.profile'),
handler: function () {
document.querySelector('.bio h3').style.transform = 'translateY(0%)'
},
offset: 80
})
var waypoint1 = new Waypoint({
element: document.querySelector('.works'),
handler: function () {
console.log(this.options.offset)
activeFloat = true;
},
offset: '70%'
})