-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
37 lines (34 loc) · 991 Bytes
/
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
// Smooth Scrolling for Navigation Links
$(document).ready(function () {
$('a[href^="#"]').on("click", function (event) {
var target = $(this.getAttribute("href"));
if (target.length) {
event.preventDefault();
$("html, body").stop().animate(
{
scrollTop: target.offset().top,
},
1000
);
}
});
});
// Form Validation for the Contact Form
$(document).ready(function () {
$("#contactForm").on("submit", function (event) {
event.preventDefault();
var name = $("#name").val();
var email = $("#email").val();
var message = $("#message").val();
if (name === "" || email === "" || message === "") {
alert("Please fill in all fields.");
} else {
alert("Form submitted successfully!");
// You can add code here to send the form data to a server if needed
}
});
});
// Tooltips for Interactive Elements
$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
});