-
Notifications
You must be signed in to change notification settings - Fork 140
/
script.js
136 lines (123 loc) · 4.91 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
"use strict";
// Correct projects numbering (Removed duplicate "23" key)
const projects = [
{ name: "01-Community-Card", tags: ["HTML", "CSS"] },
{ name: "02-qr-code-component", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "03-social-proof", tags: ["HTML", "CSS"] },
{ name: "04-nft-project", tags: ["HTML", "CSS"] },
{ name: "05-intractive-rating", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "06-product-preview", tags: ["HTML", "CSS"] },
{ name: "07-fylo-two-column-layout", tags: ["HTML", "CSS"] },
{ name: "08-profile-card", tags: ["HTML", "CSS"] },
{ name: "09-clipboard-landing-page", tags: ["HTML", "CSS"] },
{ name: "10-three-column-card", tags: ["HTML", "CSS"] },
{ name: "11-Order-summery-component", tags: ["HTML", "CSS"] },
{ name: "12-Huddle-comm-page", tags: ["HTML", "CSS"] },
{ name: "13-stat-preview-card", tags: ["HTML", "CSS"] },
{ name: "14-Huddle-landing-page", tags: ["HTML", "CSS"] },
{ name: "15-Article-Preview", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "16-base-apparel-coming-soon", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "17-advice-generator-app", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "18-chat-app-css-illustration", tags: ["HTML", "CSS"] },
{ name: "19-news-homepage", tags: ["HTML", "CSS"] },
{ name: "20-testimonials-grid-section", tags: ["HTML", "CSS"] },
{ name: "21-ecommerce-product-page", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "22-Weather-App", tags: ["HTML", "CSS", "JavaScript", "API"] },
{ name: "23-joke-generator", tags: ["HTML", "CSS", "JavaScript", "API"] },
{ name: "24-login-signup", tags: ["HTML", "CSS", "JavaScript", "API"] },
{ name: "26-shoe-website", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "27-Code_Editor", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "30-Age_Calc", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "22-url-shortening", tags: ["HTML", "CSS", "JavaScript", "API"] },
{ name: "23-Weather-App", tags: ["HTML", "CSS", "JavaScript", "API"] },
{ name: "24-joke-generator", tags: ["HTML", "CSS", "JavaScript", "API"] },
{ name: "26-guess-the-number-game", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "26-shoe-website", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "27-swiggy-clone", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "28-Zomato-clone", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "29-to-do-list", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "30-currency-converter", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "31-tic-tac-toe", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "32-calculator-application", tags: ["HTML", "CSS", "JavaScript"] },
{ name: "33-CSS-Animations", tags: ["HTML", "CSS", "JavaScript"] }
];
// Menu toggle functionality
const menuToggle = document.querySelector(".menu-toggle");
const navbarFunction = document.querySelector(".navbar-function");
if (menuToggle && navbarFunction) {
menuToggle.addEventListener("click", () => {
navbarFunction.classList.toggle("active"); // Toggle class to show/hide nav
});
}
// Populate the list of projects dynamically
const list = document.getElementById("list");
if (list) {
projects.forEach(({ name }, i) => {
const listItem = document.createElement("li");
const tags = projects[i].tags
? projects[i].tags
.map((tag) => `<span class="tag">${tag}</span>`)
.join(" ")
: "";
listItem.innerHTML = `
<a href="./${name}/index.html" target="_blank">
<img src="./${name}/design/desktop-design.jpg" alt="${name}" />
<p>${i + 1}. ${formatProjectName(name)}</p>
<div class="tags">Technologies: ${tags}</div>
</a>
<div class="links-container" target="_blank">
<a href="./${name}/index.html" class="blue">
<i class="fas fa-eye"></i>
</a>
</div>
`;
list.appendChild(listItem);
});
}
function formatProjectName(name) {
return name
.split("-")
.splice(1)
.map((word) => word[0].toUpperCase() + word.slice(1))
.join(" ");
}
// FAQs Section Script
const accordions = document.querySelectorAll(".accordion");
accordions.forEach((accordion) => {
accordion.addEventListener("click", function () {
this.classList.toggle("active");
var panel = this.nextElementSibling;
// Toggle the panel's maxHeight for smooth expand/collapse
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
});
});
// Smooth scroll-to-top button
const btn = document.querySelector(".scroll-up-btn");
if (btn) {
btn.addEventListener("click", () => {
document.documentElement.scrollTo({
top: 0,
behavior: "smooth",
});
});
}
// GSAP Animations
if (typeof gsap !== "undefined") {
gsap.from(".navbar", {
opacity: 0,
y: -50,
duration: 1.5,
ease: "power2.out",
});
gsap.from(".footer", {
opacity: 0,
y: 50,
duration: 1.5,
ease: "power2.out",
delay: 0.5,
});
}