-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
21 lines (18 loc) · 708 Bytes
/
Copy pathscript.js
File metadata and controls
21 lines (18 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Add smooth scrolling effect for navigation links
document.querySelectorAll('nav ul a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Add form submission functionality
const form = document.querySelector('form');
form.addEventListener('submit', (event) => {
event.preventDefault();
const name = form.elements['name'].value;
const email = form.elements['email'].value;
const message = form.elements['message'].value;
// Send the form data to the server using AJAX or fetch API
});