-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
55 lines (43 loc) · 1.42 KB
/
main.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
// Register window: display animation
let frontE1 = document.querySelector('.front');
const registerButton = document.querySelector('.register-button');
registerButton.addEventListener('click', (event) => {
event.preventDefault();
frontE1.classList.add('slide-up');
});
const buyButton = document.querySelector('.buy-button');
buyButton.addEventListener('click', (event) => {
event.preventDefault();
frontE1.classList.remove('slide-up');
});
// Dynamic view navigation bar
const header = document.querySelector('.header');
const desktopHeader = document.querySelector('.header-desktop');
desktopHeader.innerHTML = header.innerHTML;
inView('.header')
.on('enter', (el) => desktopHeader.classList.remove('visible'))
.on('exit', (el) => desktopHeader.classList.add('visible'));
// Tilt effect on pictures
VanillaTilt.init(document.querySelectorAll('.image'), {
max: 35,
speed: 800,
glare: true,
easing: 'cubic-bezier(.03,.98,.52,.99)',
});
// Fade in pictures
inView('.fade')
.on('enter', (img) => img.classList.add('visible'))
.on('exit', (img) => img.classList.remove('visible'));
// Smooth href navigation
const anchors = document.querySelectorAll('a');
anchors.forEach((anchor) => {
anchor.addEventListener('click', (event) => {
const href = anchor.getAttribute('href');
if (href.charAt(0) === '#') {
event.preventDefault();
document.querySelector(href).scrollIntoView({
behavior: 'smooth',
});
}
});
});