Assignment3_work_with_sliders/scripts.js

53 lines
2.2 KiB
JavaScript
Raw Normal View History

2024-12-30 06:22:29 +00:00
var copy = document.querySelector(".logos-slide").cloneNode(true);
document.querySelector(".logos").appendChild(copy);
const projects = [
{
title: "EarthLink Fiber Internet",
text: "Earthlink epitomizes leadership in digital innovation, seamlessly blending advanced technology with unbeatable connectivity. Our team led the development and design efforts for their digital infrastructure, ensuring seamless integration and optimal performance.",
imageId: "image-1"
},
{
title: "Evil Genius Games",
text: "Evil Genius Games redefines immersive gaming experiences with their innovative tabletop RPGs. Our collaboration focused on creating a seamless digital platform to support their creative storytelling and gaming mechanics.",
imageId: "image-2"
},
{
title: "Involvvely",
text: "Involvvely simplifies team collaboration with innovative tools designed to enhance productivity and communication. We developed a platform that empowers teams to work smarter and achieve their goals efficiently.",
imageId: "image-3"
}
];
let currentProjectIndex = 0;
function updateProjectDisplay() {
const titleElement = document.getElementById("project-title");
const textElement = document.getElementById("project-text");
// Update title and text
titleElement.textContent = projects[currentProjectIndex].title;
textElement.textContent = projects[currentProjectIndex].text;
// Update active image
document.querySelectorAll(".project-cards img").forEach((img, index) => {
img.classList.toggle("active", index === currentProjectIndex);
});
// Update indicators
document.querySelectorAll(".indicators span").forEach((indicator, index) => {
indicator.classList.toggle("active", index === currentProjectIndex);
});
}
function nextProject() {
currentProjectIndex = (currentProjectIndex + 1) % projects.length;
updateProjectDisplay();
}
function goToProject(index) {
currentProjectIndex = index;
updateProjectDisplay();
}
// Initialize display
updateProjectDisplay();