-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
57 lines (50 loc) · 1.82 KB
/
script.js
File metadata and controls
57 lines (50 loc) · 1.82 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Home
document.addEventListener("DOMContentLoaded", () => {
// Sidebar Toggle for Mobile
const sidebar = document.querySelector(".sidebar");
const menuToggle = document.querySelector(".menu-toggle");
if (menuToggle) {
menuToggle.addEventListener("click", () => {
sidebar.style.display = sidebar.style.display === "block" ? "none" : "block";
});
}
// menuToggle
const toggleButton = document.querySelector(".menu-toggle");
const menu = document.querySelector(".menu");
toggleButton.addEventListener("click", function() {
menu.classList.toggle("show"); // Class add/remove karke toggle karega
});
// Smooth Scrolling
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener("click", function (e) {
e.preventDefault();
document.querySelector(this.getAttribute("href")).scrollIntoView({
behavior: "smooth"
});
});
});
});
// About
function toggleText(button) {
let shortText = button.previousElementSibling.previousElementSibling;
let fullText = button.previousElementSibling;
if (fullText.classList.contains("hidden")) {
fullText.classList.remove("hidden");
fullText.style.display = "block";
button.innerText = "Read Less";
} else {
fullText.classList.add("hidden");
fullText.style.display = "none";
button.innerText = "Read More";
}
}
// project
document.addEventListener("DOMContentLoaded", () => {
const skillBars = document.querySelectorAll(".fill");
skillBars.forEach(bar => {
const width = bar.getAttribute("data-width");
setTimeout(() => {
bar.style.width = width;
}, 500);
});
});