-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
24 lines (21 loc) · 783 Bytes
/
index.js
File metadata and controls
24 lines (21 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$(window).scroll(function () {
const
a = $(this).scrollTop(),
b = 400,
t = window.pageYOffset;
$(".parallax").css('transform', 'translate(-' + a / 1.6 + 'px, -' + 1 - a / b + 'px)');
$(".one").css('bottom', -(t * 0.3) + 'px');
$(".two").css('bottom', -(t * 0.4) + 'px');
$(".three").css('bottom', -(t * 0.5) + 'px');
$(".four").css('bottom', -(t * 0.6) + 'px');
$(".five").css('bottom', -(t * 0.7) + 'px');
});
$("header").on('mousemove', e => {
const cx = $(window).width() / 2,
cy = $(window).height() / 2,
x = (cx - e.pageX) / cx * 2,
y = (cy - e.pageY) / cy * 2;
$(".two").css('transform', `translate(${x}px, ${y}px)`);
$(".four").css('transform', `translate(-${x}px, ${y}px)`);
$(".five").css('transform', `translate(${x}px, -${y}px)`);
});