-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
88 lines (79 loc) · 2.27 KB
/
script.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
"use strict";
// const scroll = new LocomotiveScroll({
// el: document.querySelector("#main"),
// smooth: true,
// lerp: 0.09,
// });
gsap.from("#Main-top", {
x: -100,
opacity: 0,
duration: 2,
ease: "power4.out",
});
gsap.from("#main-heading", {
y: 0,
scale: 0.8,
opacity: 0,
duration: 1,
});
gsap.from("#main-para", {
y: -100,
opacity: 0,
duration: 1,
});
// open Menu
function openMenu() {
document.querySelector(".menu").classList.add("hidden");
document.querySelector(".close").classList.remove("hidden");
document
.querySelector("#mobile-nav")
.classList.remove("translate-x-[-36rem]");
document
.querySelector("#mobile-nav")
.classList.add("translate-x-[0rem] duration-500");
}
function closeMenu() {
document.querySelector(".menu").classList.remove("hidden");
document.querySelector(".close").classList.add("hidden");
document.querySelector("#mobile-nav").classList.add("translate-x-[-36rem]");
document.querySelector("#mobile-nav").classList.remove("translate-x-[0rem]");
}
document.addEventListener("scroll", () => {
const scrollPos =
window.scrollY ||
window.scrollTop ||
document.getElementsByTagName("html").scrollTop;
const sideNav = document.querySelector(".side-nav");
const back = document.querySelector(".back-to-top");
if (scrollPos > 10) {
sideNav.classList.remove("hidden");
sideNav.classList.add("block");
back.classList.remove("hidden");
back.classList.add("block");
} else {
sideNav.classList.remove("block");
sideNav.classList.add("hidden");
back.classList.remove("block");
back.classList.add("hidden");
}
console.log(scrollPos);
});
(function () {
emailjs.init("ijCUMwA8uohC5CXHX");
})();
document
.getElementById("contact-form")
.addEventListener("submit", function (event) {
event.preventDefault(); // Prevent the default form submission
emailjs.sendForm("service_4rf88pg", "template_ovjg0d8", this).then(
function (response) {
console.log("SUCCESS!", response.status, response.text);
alert("Message sent successfully!");
document.getElementById("contact-form").reset();
},
function (error) {
console.log("FAILED...", error);
alert("Failed to send message. Please try again.");
}
);
});