/* ========================= UBE HUB JAVASCRIPT ========================= */ // AOS ANIMATIONS AOS.init({ duration: 1000, once: true }); /* ========================= MOBILE MENU ========================= */ const hamburger = document.getElementById("hamburger"); const navMenu = document.getElementById("navMenu"); hamburger.addEventListener("click", () => { navMenu.classList.toggle("show"); }); /* ========================= DARK / LIGHT MODE ========================= */ const themeBtn = document.getElementById("themeBtn"); themeBtn.addEventListener("click", () => { document.body.classList.toggle("light"); if(document.body.classList.contains("light")){ themeBtn.textContent = "☀️"; } else { themeBtn.textContent = "🌙"; } }); /* ========================= SEARCH SYSTEM ========================= */ const searchBtn = document.querySelector(".search-box button"); const searchInput = document.querySelector(".search-box input"); searchBtn.addEventListener("click", () => { const searchValue = searchInput.value.toLowerCase(); if(searchValue.includes("flight")){ document .querySelector(".services") .scrollIntoView({behavior:"smooth"}); alert("✈ Flight Booking Service Available"); } else if(searchValue.includes("hotel")){ document .querySelector(".services") .scrollIntoView({behavior:"smooth"}); alert("🏨 Hotel Booking Service Available"); } else if(searchValue.includes("visa")){ document .querySelector(".services") .scrollIntoView({behavior:"smooth"}); alert("🛂 Visa Service Available"); } else if(searchValue.includes("passport")){ document .querySelector(".services") .scrollIntoView({behavior:"smooth"}); alert("📘 Passport Service Available"); } else if(searchValue.includes("id")){ document .querySelector(".services") .scrollIntoView({behavior:"smooth"}); alert("🪪 ID Card Service Available"); } else{ alert("Search results coming soon."); } }); /* ========================= CONTACT FORM ========================= */ const contactForm = document.querySelector(".contact-form"); if (contactForm) { contactForm.addEventListener("submit", function(e){ e.preventDefault(); alert("✅ Thank you! Your request has been received. UBE HUB will contact you soon."); contactForm.reset(); }); } /* ========================= HERO IMAGE SLIDER ========================= */ const heroImages = [ "https://images.unsplash.com/photo-1436491865332-7a61a109cc05?w=1800", // airplane "https://images.unsplash.com/photo-1566073771259-6a8506099945?w=1800", // hotel "https://images.unsplash.com/photo-1450101499163-c8848c66ca85?w=1800", // visa/passport "https://images.unsplash.com/photo-1516321318423-f06f85e504b3?w=1800" // IT ]; const hero = document.querySelector(".hero"); let currentImage = 0; setInterval(() => { currentImage++; if(currentImage >= heroImages.length){ currentImage = 0; } hero.style.background = `linear-gradient( rgba(7,27,59,.7), rgba(7,27,59,.7) ), url('${heroImages[currentImage]}')`; hero.style.backgroundSize = "cover"; hero.style.backgroundPosition = "center"; }, 5000); /* ========================= CARD ANIMATION ========================= */ const cards = document.querySelectorAll(".card"); cards.forEach(card => { card.addEventListener("mouseenter", () => { card.style.boxShadow = "0 20px 40px rgba(0,87,217,.4)"; }); card.addEventListener("mouseleave", () => { card.style.boxShadow = "none"; }); }); /* ========================= NAVBAR SCROLL EFFECT ========================= */ window.addEventListener("scroll", () => { const navbar = document.querySelector(".navbar"); if(window.scrollY > 50){ navbar.style.background = "rgba(0,0,0,.55)"; navbar.style.backdropFilter = "blur(20px)"; } else{ navbar.style.background = "rgba(0,0,0,.2)"; } }); /* ========================= SERVICE BUTTONS ========================= */ const serviceButtons = document.querySelectorAll(".card button"); serviceButtons.forEach(button => { button.addEventListener("click", () => { document .querySelector("#contact") .scrollIntoView({ behavior:"smooth" }); }); }); /* ========================= WELCOME MESSAGE ========================= */ window.addEventListener("load", () => { setTimeout(() => { console.log( "🚀 UBE HUB Website Loaded Successfully" ); },1000); }); /* ========================= FORM HANDLER ========================= */ /* ========================= EMAILJS FORM HANDLER ========================= */ function handleFormSubmit(event) { event.preventDefault(); const form = event.target; const formData = { name: form.name?.value || "", email: form.email?.value || "", phone: form.phone?.value || "", dob: form.dob?.value || "", service: form.service?.value || "", company: form.company?.value || "", service_type: form.service_type?.value || "", visa_type: form.visa_type?.value || "", id_type: form.id_type?.value || "", website_type: form.website_type?.value || "", budget: form.budget?.value || "", message: form.message?.value || "" }; emailjs.send( "service_2phrblv", "template_hbrnj9d", formData ) .then(function () { alert( "✅ Thank you! Your request has been submitted successfully. We will contact you soon." ); form.reset(); window.scrollTo({ top: 0, behavior: "smooth" }); }) .catch(function (error) { console.error("EmailJS Error:", error); alert( "❌ Failed to send request. Please try again." ); }); } /* ========================= ANIMATED TEXT EFFECT ========================= */ function animateHeroText(){ const heroH1 = document.querySelector(".hero h1"); if(!heroH1) return; const text = heroH1.textContent; heroH1.textContent = ""; let index = 0; function typeCharacter(){ if(index < text.length){ heroH1.textContent += text[index]; index++; setTimeout(typeCharacter, 50); } } typeCharacter(); } /* ========================= ELEMENT VISIBILITY FIX ========================= */ // Make sure images load properly window.addEventListener("load", () => { const images = document.querySelectorAll("img"); images.forEach(img => { img.addEventListener("error", () => { // Use placeholder if image fails img.src = "https://via.placeholder.com/600x400?text=Image+Loading"; img.style.opacity = "0.8"; }); }); });