-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
303 lines (257 loc) · 9.66 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
document.addEventListener("DOMContentLoaded", () => {
// Set current year in footer
document.getElementById("current-year").textContent = new Date().getFullYear()
// Navigation scroll behavior
const nav = document.getElementById("main-nav")
const navLinks = document.querySelectorAll(".nav-links a")
let lastScrollY = window.scrollY
// Update active nav link based on scroll position
function updateActiveNavLink() {
const sections = ["home", "about", "portfolio", "contact"]
let currentSection = ""
sections.forEach((section) => {
const element = document.getElementById(section)
if (element) {
const rect = element.getBoundingClientRect()
if (rect.top <= 100 && rect.bottom >= 100) {
currentSection = section
}
}
})
navLinks.forEach((link) => {
if (link.getAttribute("href") === `#${currentSection}`) {
link.classList.add("active")
} else {
link.classList.remove("active")
}
})
}
// Handle scroll events for navigation visibility
window.addEventListener("scroll", () => {
const currentScrollY = window.scrollY
if (currentScrollY > lastScrollY && currentScrollY > 100) {
nav.classList.remove("show")
nav.classList.add("hide")
} else {
nav.classList.remove("hide")
nav.classList.add("show")
}
lastScrollY = currentScrollY
updateActiveNavLink()
// Check for elements to animate on scroll
checkScrollAnimation()
})
// Initialize active nav link on page load
updateActiveNavLink()
// Animate elements on scroll
const animatedElements = document.querySelectorAll(".animate-on-scroll")
function checkScrollAnimation() {
animatedElements.forEach((element) => {
const elementPosition = element.getBoundingClientRect().top
const screenPosition = window.innerHeight / 1.2
if (elementPosition < screenPosition) {
element.classList.add("animate")
}
})
}
// Initial check for animations
checkScrollAnimation()
// Animate hero elements on load
setTimeout(() => {
document.querySelectorAll(".hero-animate").forEach((el, index) => {
setTimeout(() => {
el.classList.add("animate")
}, index * 200)
})
}, 100)
// Aqui adicionamos as informações do carrocel
const projects = [
{
id: 1,
title: "Central de Software",
description:
"Loja de Programas",
technologies: ["Phyton", "Chocalatey", "PyQt5", "QtWidgets", "QtCore", "QtGui"],
image: "public/centralsoftware.PNG",
detailedDescription:
"Uma loja para gerenciar os programas homologados pela empresa para que os usuarios possam instalar sem a necessidae de acionar um suporte tecnico.",
},
{
id: 2,
title: "Implantação Google Workspace",
description: "Gerenciou a migração do Zimbra para a nova plataforma, com integração ao Active Directory (AD), validou o processo e garantiu a funcionalidade.",
technologies: ["Liderança", "Comunicação", "Resolução de Problemas"],
image: "public/zimbra_gmail.png",
detailedDescription:
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
},
{
id: 3,
title: "Implantação Adobe Acrobat ProX",
description: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
technologies: ["xxxxxxxxxxx", "xxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxx"],
image: "https://placehold.co/600x400",
detailedDescription:
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
},
{
id: 4,
title: "Atualização GLPI v10",
description: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
technologies: ["xxxxxxxxxxx", "xxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxx"],
image: "https://placehold.co/600x400",
detailedDescription:
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
},
{
id: 5,
title: "Contratação Internet Satelital StarLink",
description: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
technologies: ["xxxxxxxxxxx", "xxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxx"],
image: "https://placehold.co/600x400",
detailedDescription:
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
},
{
id: 6,
title: "xxxxxxxxxxxxxxxxxxxx",
description: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
technologies: ["xxxxxxxxxxx", "xxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxx"],
image: "https://placehold.co/600x400",
detailedDescription:
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
},
]
const carousel = document.getElementById("project-carousel")
const dotsContainer = document.getElementById("carousel-dots")
const prevBtn = document.querySelector(".prev-btn")
const nextBtn = document.querySelector(".next-btn")
let currentIndex = 0
// Create project cards
function createProjectCards() {
carousel.innerHTML = ""
dotsContainer.innerHTML = ""
projects.forEach((project, index) => {
// Create project card
const card = document.createElement("div")
card.className = "project-card"
card.innerHTML = `
<div class="project-image">
<img src="${project.image}" alt="${project.title}">
</div>
<div class="project-content">
<h3>${project.title}</h3>
<p>${project.description}</p>
<div class="project-technologies">
${project.technologies.map((tech) => `<span class="tech-badge">${tech}</span>`).join("")}
</div>
<button class="btn btn-primary btn-full view-details" data-id="${project.id}">Ver Detalhes</button>
</div>
`
carousel.appendChild(card)
// Create dot indicator
const dot = document.createElement("button")
dot.className = `dot ${index === 0 ? "active" : ""}`
dot.setAttribute("data-index", index)
dot.setAttribute("aria-label", `Ir para projeto ${index + 1}`)
dotsContainer.appendChild(dot)
})
// Add event listeners to view details buttons
document.querySelectorAll(".view-details").forEach((button) => {
button.addEventListener("click", function () {
const projectId = Number.parseInt(this.getAttribute("data-id"))
openProjectModal(projectId)
})
})
// Add event listeners to dots
document.querySelectorAll(".dot").forEach((dot) => {
dot.addEventListener("click", function () {
const index = Number.parseInt(this.getAttribute("data-index"))
goToSlide(index)
})
})
}
// Initialize carousel
createProjectCards()
// Carousel navigation
function goToSlide(index) {
currentIndex = index
carousel.style.transform = `translateX(-${currentIndex * 100}%)`
updateDots()
}
function updateDots() {
document.querySelectorAll(".dot").forEach((dot, index) => {
if (index === currentIndex) {
dot.classList.add("active")
} else {
dot.classList.remove("active")
}
})
}
prevBtn.addEventListener("click", () => {
currentIndex = (currentIndex - 1 + projects.length) % projects.length
goToSlide(currentIndex)
})
nextBtn.addEventListener("click", () => {
currentIndex = (currentIndex + 1) % projects.length
goToSlide(currentIndex)
})
// Project modal functionality
const modal = document.getElementById("project-modal")
const modalImage = document.getElementById("modal-image")
const modalTitle = document.getElementById("modal-title")
const modalTechnologies = document.getElementById("modal-technologies")
const modalDescription = document.getElementById("modal-description")
const closeModal = document.querySelector(".close-modal")
function openProjectModal(projectId) {
const project = projects.find((p) => p.id === projectId)
if (!project) return
modalImage.src = project.image
modalImage.alt = project.title
modalTitle.textContent = project.title
modalTechnologies.innerHTML = ""
project.technologies.forEach((tech) => {
const badge = document.createElement("span")
badge.className = "tech-badge"
badge.textContent = tech
modalTechnologies.appendChild(badge)
})
modalDescription.textContent = project.detailedDescription
modal.classList.add("show")
document.body.style.overflow = "hidden"
}
function closeProjectModal() {
modal.classList.remove("show")
document.body.style.overflow = "auto"
}
closeModal.addEventListener("click", closeProjectModal)
// Close modal when clicking outside content
modal.addEventListener("click", (e) => {
if (e.target === modal) {
closeProjectModal()
}
})
// Close modal on escape key
document.addEventListener("keydown", (e) => {
if (e.key === "Escape" && modal.classList.contains("show")) {
closeProjectModal()
}
})
// Contact form submission
const contactForm = document.getElementById("contact-form")
contactForm.addEventListener("submit", (e) => {
e.preventDefault()
// Get form values
const name = document.getElementById("name").value
const email = document.getElementById("email").value
const phone = document.getElementById("phone").value
const message = document.getElementById("message").value
// Here you would typically send the form data to a server
// For this example, we'll just log it to the console
console.log("Form submitted:", { name, email, phone, message })
// Show success message (in a real app, you'd wait for server response)
alert("Mensagem enviada com sucesso! Entraremos em contato em breve.")
// Reset form
contactForm.reset()
})
})