-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript1.js
More file actions
33 lines (31 loc) · 1.19 KB
/
Copy pathscript1.js
File metadata and controls
33 lines (31 loc) · 1.19 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
30
31
32
33
document.addEventListener("DOMContentLoaded", function () {
// Smooth scrolling for navigation links
document.querySelectorAll("nav a").forEach(anchor => {
anchor.addEventListener("click", function (e) {
e.preventDefault();
document.querySelector(this.getAttribute("href")).scrollIntoView({
behavior: "smooth"
});
});
});
// Hover effect for sections
document.querySelectorAll("section").forEach(section => {
section.addEventListener("mouseenter", function () {
this.style.backgroundColor = "#e0f7fa";
});
section.addEventListener("mouseleave", function () {
this.style.backgroundColor = "white";
});
});
// Scroll functionality for arrow buttons
document.querySelectorAll('.arrow').forEach(arrow => {
arrow.addEventListener('click', function () {
const targetSection = document.querySelector(this.getAttribute('data-target'));
if (targetSection) {
targetSection.scrollIntoView({
behavior: 'smooth'
});
}
});
});
});