-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
90 lines (78 loc) · 2.41 KB
/
script.js
File metadata and controls
90 lines (78 loc) · 2.41 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
let slideIndex = 0
carousel()
function carousel() {
let i
let x = document.getElementsByClassName("mySlides")
for (i = 0; i < x.length; i++) {
x[i].style.display = "none"
}
slideIndex++
if (slideIndex > x.length) {
slideIndex = 1
}
x[slideIndex - 1].style.display = "block"
setTimeout(carousel, 3000)
}
// ANIMATIONS
const intro = document.querySelector('.intro-content');
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.toggle('showIntro');
observer.disconnect();
}
});
});
observer.observe(intro);
const phrase = document.querySelector('.image-section-content');
const observer1 = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.toggle('showImagePhrase');
observer1.disconnect();
}
});
});
observer1.observe(phrase);
const product = document.querySelector('#product1');
const product2 = document.querySelector('#product2');
const product3 = document.querySelector('#product3');
const observer2 = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.animation = "slider 1.75s ease-out"
observer2.disconnect();
}
});
});
const observer3 = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.animation = "slider 2s ease-out"
observer3.disconnect();
}
});
});
const observer4 = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.animation = "slider 2.5s ease-out"
// observer4.disconnect();
}
});
});
observer2.observe(product);
observer3.observe(product2);
observer4.observe(product3);
//nodemailer sending email for contact form
function sendEmail() {
const name = document.querySelector('#name').value;
document.querySelector('#name').value = '';
const email = document.querySelector('#email').value;
document.querySelector('#email').value = '';
const message = document.querySelector('#message').value;
document.querySelector('#message').value = '';
fetch(`https://nodejs-node-mailer-sample.annabananna.repl.co/send?name=${name}&email=${email}&message=${message}`);
alert("Email sent! Give us up to five business days to get back to you!")
return true;
}