forked from hinzullah/Diviciprince
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.js
66 lines (54 loc) · 1.77 KB
/
scripts.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
document.addEventListener("DOMContentLoaded", function() {
const sections = document.querySelectorAll("section");
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("fade-in");
observer.unobserve(entry.target);
}
});
});
sections.forEach(section => {
observer.observe(section);
});
});
function toggleAnswer(element) {
const answer = element.nextElementSibling;
if (answer.style.display === "block") {
answer.style.display = "none";
} else {
answer.style.display = "block";
}
}
let currentSlide = 0;
function changeSlide(direction) {
const slides = document.querySelectorAll('.slide');
currentSlide = (currentSlide + direction + slides.length) % slides.length;
document.querySelector('.slides').style.transform = `translateX(-${currentSlide * 100}%)`;
}
document.addEventListener('DOMContentLoaded', () => {
changeSlide(0); // Initialize the first slide
// Auto slide every 3 seconds
setInterval(() => {
changeSlide(1);
}, 3000);
});
(function(){
emailjs.init("TyGP7Pv_5UANq5fsx");
})();
function sendEmail() {
var name = document.getElementById("name").value;
var email = document.getElementById("email").value;
var message = document.getElementById("message").value;
var templateParams = {
from_name: name,
from_email: email,
message: message
};
emailjs.send('service_mo2phto', 'template_yte9kgy', templateParams)
.then(function(response) {
alert('SUCCESS!', response.status, response.text);
}, function(error) {
alert('FAILED...', error);
});
}