-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (23 loc) · 1.1 KB
/
script.js
File metadata and controls
29 lines (23 loc) · 1.1 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
const hamburger = document.querySelector('.hamburger');
const navLinksMobile = document.querySelector('.nav-links-mobile');
const mobileLinks = document.querySelector('.mobile');
// Toggle mobile navigation
hamburger.addEventListener('click', () => {
navLinksMobile.classList.toggle('active');
});
// Close mobile navigation when a link is clicked
mobileLinks.addEventListener('click', () => {
navLinksMobile.classList.remove('active');
});
document.getElementById("contactForm").addEventListener("submit", function (e) {
e.preventDefault(); // Prevent the form from actually submitting
// Get form data
const name = document.getElementById("name").value;
const email = document.getElementById("email").value;
const subject = document.getElementById("subject").value;
const message = document.getElementById("message").value;
// Construct the mailto link
const mailtoLink = `mailto:ikonets@yahoo.com?subject=${encodeURIComponent(subject)}&body=Hi, my name is ${encodeURIComponent(name)}.%0D%0A%0D%0A${encodeURIComponent(message)}`;
// Redirect to mailto link
window.location.href = mailtoLink;
});