-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
56 lines (48 loc) · 1.74 KB
/
app.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
var tablinks = document.getElementsByClassName("tab-links");
var tabcontents = document.getElementsByClassName("tab-contents");
function opentab(tabname) {
for (tablink of tablinks) {
tablink.classList.remove("active-link");
}
for (tabcontent of tabcontents) {
tabcontent.classList.remove("active-tab");
}
event.currentTarget.classList.add("active-link");
document.getElementById(tabname).classList.add("active-tab");
}
// moving sideMenu
var sidemenu = document.getElementById("sidemenu");
function openmenu() {
sidemenu.style.right = "0";
}
function closemenu() {
sidemenu.style.right = "-200px";
}
// mail
// const scriptURL = '<https://script.google.com/macros/s/AKfycbxza7MoNOGi0ASlaXpxF0lKPh38aA99Tq9w-1cMO9CoEKARPMPE0DqCJbAsCx51cyrd/exec>'
// const form = document.forms['submit-to-google-sheet']
// form.addEventListener('submit', e => {
// e.preventDefault()
// fetch(scriptURL, { method: 'POST', body: new FormData(form)})
// .then(response => console.log('Success!', response))
// .catch(error => console.error('Error!', error.message))
// })
function sendMail() {
var params = {
name: document.getElementById("name").value,
email: document.getElementById("email").value,
message: document.getElementById("message").value,
};
const serviceID = "service_0ehof3p";
const templateID = "template_aa0bzbs";
emailjs
.send(serviceID, templateID, params)
.then((res) => {
document.getElementById("name").value = "";
document.getElementById("email").value = "";
document.getElementById("message").value = "";
console.log(res);
alert("your message sent successfully");
})
.cathch((err) => console.log(err));
}