From 63f93b7902047e858f2f50c0fa59bd6cf342a4bf Mon Sep 17 00:00:00 2001 From: blake Date: Fri, 13 Feb 2026 11:26:55 -0600 Subject: [PATCH] Re-worked the folder structure and file naming. Fixed a bug where contact form wasn't showing up on other pages. --- index.html | 33 +++-- script.js | 121 ++++++++++-------- .../ecommerce/index.html | 76 +++++------ support.html => services/support/index.html | 76 +++++------ .../web-design/index.html | 73 ++++++----- .../web-development/index.html | 76 +++++------ 6 files changed, 240 insertions(+), 215 deletions(-) rename ecommerce.html => services/ecommerce/index.html (80%) rename support.html => services/support/index.html (79%) rename web-design.html => services/web-design/index.html (81%) rename web-development.html => services/web-development/index.html (81%) diff --git a/index.html b/index.html index 7b5ffc8..fd980ba 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,6 @@ - Cosmically Creative ‐ Custom Web Design & Development with HTML, CSS @@ -41,18 +40,24 @@ <a class="main-nav-link" href="#services">Services</a> <ul class="dropdown-menu"> <li> - <a class="dropdown-link" href="web-design.html">Web Design</a> + <a class="dropdown-link" href="services/web-design/" + >Web Design</a + > </li> <li> - <a class="dropdown-link" href="web-development.html" + <a class="dropdown-link" href="services/web-development/" >Web Development</a > </li> <li> - <a class="dropdown-link" href="ecommerce.html">eCommerce</a> + <a class="dropdown-link" href="services/ecommerce/" + >eCommerce</a + > </li> <li> - <a class="dropdown-link" href="support.html">Ongoing Support</a> + <a class="dropdown-link" href="services/support/" + >Ongoing Support</a + > </li> </ul> </li> @@ -99,7 +104,7 @@ we can build together! </p> <div class="services-grid animate-on-scroll"> - <a class="services-link" href="web-design.html" + <a class="services-link" href="services/web-design/" ><div class="service-card"> <div class="service-card-header"> <img @@ -120,7 +125,7 @@ </p> </div></a > - <a class="services-link" href="web-development.html" + <a class="services-link" href="services/web-development/" ><div class="service-card"> <div class="service-card-header"> <img @@ -141,7 +146,7 @@ </p> </div> </a> - <a class="services-link" href="ecommerce.html" + <a class="services-link" href="services/ecommerce/" ><div class="service-card"> <div class="service-card-header"> <img @@ -163,7 +168,7 @@ </p> </div> </a> - <a class="services-link" href="support.html" + <a class="services-link" href="services/support/" ><div class="service-card"> <div class="service-card-header"> <img @@ -514,20 +519,22 @@ <a class="main-nav-link" href="#services">Services</a> <ul class="dropdown-menu"> <li> - <a class="dropdown-link" href="web-design.html" + <a class="dropdown-link" href="services/web-design/" >Web Design</a > </li> <li> - <a class="dropdown-link" href="web-development.html" + <a class="dropdown-link" href="services/web-development/" >Web Development</a > </li> <li> - <a class="dropdown-link" href="ecommerce.html">eCommerce</a> + <a class="dropdown-link" href="services/ecommerce/" + >eCommerce</a + > </li> <li> - <a class="dropdown-link" href="support.html" + <a class="dropdown-link" href="services/support/" >Ongoing Support</a > </li> diff --git a/script.js b/script.js index 66d1f52..229d7af 100644 --- a/script.js +++ b/script.js @@ -79,8 +79,6 @@ function showSlide(index) { slides[currentSlide].classList.add("active"); } -buildSlides(); - function setSlidesHeight() { const slides = document.querySelectorAll(".testimonial-slide"); let maxHeight = 0; @@ -93,26 +91,32 @@ function setSlidesHeight() { slides[currentSlide].classList.add("active"); } -setSlidesHeight(); -window.addEventListener("resize", setSlidesHeight); +if (slidesContainer) { + buildSlides(); + setSlidesHeight(); + window.addEventListener("resize", setSlidesHeight); -document - .querySelector(".testimonial-btn--prev") - .addEventListener("click", () => { - showSlide(currentSlide - 1); - }); + const testimonialPrevBtn = document.querySelector(".testimonial-btn--prev"); + const testimonialNextBtn = document.querySelector(".testimonial-btn--next"); -document - .querySelector(".testimonial-btn--next") - .addEventListener("click", () => { - showSlide(currentSlide + 1); - }); + if (testimonialPrevBtn) { + testimonialPrevBtn.addEventListener("click", () => { + showSlide(currentSlide - 1); + }); + } + + if (testimonialNextBtn) { + testimonialNextBtn.addEventListener("click", () => { + showSlide(currentSlide + 1); + }); + } +} // Project Carousel const projectTrack = document.querySelector(".project-track"); -const projectCards = Array.from( - projectTrack.querySelectorAll(".project-slide"), -); +const projectCards = projectTrack + ? Array.from(projectTrack.querySelectorAll(".project-slide")) + : []; let currentProject = 0; let isSliding = false; @@ -200,53 +204,64 @@ function slideToProject(newIndex, direction) { }, 700); } -// Initial state -applyPositions(getPositions(0, null)); +if (projectTrack && projectCards.length > 0) { + // Initial state + applyPositions(getPositions(0, null)); -document.querySelector(".project-btn--prev").addEventListener("click", () => { - const total = projectCards.length; - const newIndex = (currentProject - 1 + total) % total; - slideToProject(newIndex, "prev"); -}); + const projectPrevBtn = document.querySelector(".project-btn--prev"); + const projectNextBtn = document.querySelector(".project-btn--next"); -document.querySelector(".project-btn--next").addEventListener("click", () => { - const total = projectCards.length; - const newIndex = (currentProject + 1) % total; - slideToProject(newIndex, "next"); -}); + if (projectPrevBtn) { + projectPrevBtn.addEventListener("click", () => { + const total = projectCards.length; + const newIndex = (currentProject - 1 + total) % total; + slideToProject(newIndex, "prev"); + }); + } + + if (projectNextBtn) { + projectNextBtn.addEventListener("click", () => { + const total = projectCards.length; + const newIndex = (currentProject + 1) % total; + slideToProject(newIndex, "next"); + }); + } +} // Project Carousel Swipe Support let touchStartX = 0; let touchEndX = 0; const swipeThreshold = 50; -projectTrack.addEventListener( - "touchstart", - (e) => { - touchStartX = e.changedTouches[0].clientX; - }, - { passive: true }, -); +if (projectTrack && projectCards.length > 0) { + projectTrack.addEventListener( + "touchstart", + (e) => { + touchStartX = e.changedTouches[0].clientX; + }, + { passive: true }, + ); -projectTrack.addEventListener( - "touchend", - (e) => { - touchEndX = e.changedTouches[0].clientX; - const diff = touchStartX - touchEndX; + projectTrack.addEventListener( + "touchend", + (e) => { + touchEndX = e.changedTouches[0].clientX; + const diff = touchStartX - touchEndX; - if (Math.abs(diff) > swipeThreshold) { - const total = projectCards.length; - if (diff > 0) { - const newIndex = (currentProject + 1) % total; - slideToProject(newIndex, "next"); - } else { - const newIndex = (currentProject - 1 + total) % total; - slideToProject(newIndex, "prev"); + if (Math.abs(diff) > swipeThreshold) { + const total = projectCards.length; + if (diff > 0) { + const newIndex = (currentProject + 1) % total; + slideToProject(newIndex, "next"); + } else { + const newIndex = (currentProject - 1 + total) % total; + slideToProject(newIndex, "prev"); + } } - } - }, - { passive: true }, -); + }, + { passive: true }, + ); +} // Scroll Animations document.addEventListener("DOMContentLoaded", () => { diff --git a/ecommerce.html b/services/ecommerce/index.html similarity index 80% rename from ecommerce.html rename to services/ecommerce/index.html index 9fe4bfc..aeec482 100644 --- a/ecommerce.html +++ b/services/ecommerce/index.html @@ -14,12 +14,12 @@ rel="stylesheet" /> - <link rel="apple-icon" href="img/favicons/favicon-apple.webp" /> - <link rel="manifest" href="manifest.webmanifest" /> - <link rel="icon" href="img/favicons/favicon.webp" /> + <link rel="apple-icon" href="../../img/favicons/favicon-apple.webp" /> + <link rel="manifest" href="../../manifest.webmanifest" /> + <link rel="icon" href="../../img/favicons/favicon.webp" /> - <link rel="stylesheet" href="css/style.css" /> - <link rel="stylesheet" href="css/queries.css" /> + <link rel="stylesheet" href="../../css/style.css" /> + <link rel="stylesheet" href="../../css/queries.css" /> <title>Cosmically Creative - Web Design & Development @@ -27,29 +27,29 @@