Fashion Personality Quiz .quiz-button { display: inline-block; padding: 0.75em 1.5em; text-decoration: none; background-color: #EDCFC1; color: #FFF; font-size: 1rem; font-weight: bold; border-radius: 3px; cursor: pointer; box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2); } .progress-bar { width: 100%; height: 10px; background-color: #f3f3f3; border-radius: 3px; margin-bottom: 20px; } .progress-bar-inner { height: 100%; background-color: #EDCFC1; border-radius: 3px; } 1. How would you describe your wardrobe staples? Timeless and elegant Current and fashionable Flowy and eclectic Clean and simple Back Next 2. Which accessory would you most likely wear? A strand of pearls A statement necklace Layered bracelets A minimalist watch Back Next 3. What is your go-to color palette? Neutral tones and classic colors Vibrant hues and trendy shades Earthy and warm tones Monochromatic and muted colors Back Next 4. Which outfit best represents your personal style? Tailored blazer, blouse, and slacks Off-the-shoulder top and ripped jeans Flowing maxi dress and sandals Turtleneck, cropped trousers, and loafers Back Next 5. How do you feel about patterns and prints? I prefer timeless patterns like stripes or plaids I love to wear the latest trends in patterns and prints I enjoy mixing and matching various patterns and textures I typically stick to solid colors Back Next 6. What is your preferred silhouette? Structured and fitted Bold and eye-catching Loose and comfortable Streamlined and sleek Back Next 7. Which fabrics do you gravitate toward? Luxurious materials like silk or cashmere Trendy fabrics, including the latest in sustainable materials Natural fabrics, such as linen or hemp Versatile and low-maintenance materials like cotton or polyester Back Next 8. What kind of shoes do you usually wear? Classic pumps or loafers Trendy sneakers or statement heels Sandals or espadrilles Minimalist flats or ankle boots Back Next 9. Which celebrity's style do you admire the most? Audrey Hepburn or George Clooney Rihanna or Harry Styles Florence Welch or Johnny Depp Tilda Swinton or Ryan Gosling Back Next 10. How do you approach shopping for new clothes? I invest in quality, timeless pieces I frequently update my wardrobe with the latest trends I love discovering unique items at thrift stores or markets I prioritize function and simplicity when choosing new clothes Back Next Take the quiz again const nextButtons = document.querySelectorAll(".next-btn"); const backButtons = document.querySelectorAll(".back-btn"); nextButtons.forEach((button, index) => { button.addEventListener("click", handleButtonClick("next", index)); }); backButtons.forEach((button, index) => { button.addEventListener("click", handleButtonClick("back", index)); }); function handleButtonClick(action, index) { return () => { const currentQuestion = action === "next" ? nextButtons[index].parentElement : backButtons[index].parentElement; const nextQuestion = action === "next" ? currentQuestion.nextElementSibling : currentQuestion.previousElementSibling; const isAnswered = currentQuestion.querySelector("input[type='radio']:checked"); if (action === "next" && !isAnswered) { alert("Please answer the question before proceeding."); return; } currentQuestion.style.display = "none"; nextQuestion.style.display = "block"; // Update progress bar const progressBar = document.querySelector(".progress-bar-inner"); const totalQuestions = nextButtons.length; const progressPercentage = ((index + (action === "next" ? 1 : -1)) / totalQuestions) * 100; progressBar.style.width = progressPercentage + "%"; }; } // Your previous retake button code const retakeButton = document.querySelector(".retake-btn"); nextButtons.forEach((button, index) => { button.addEventListener("click", () => { const currentQuestion = button.parentElement; const nextQuestion = currentQuestion.nextElementSibling; const isAnswered = currentQuestion.querySelector("input[type='radio']:checked"); if (!isAnswered) { alert("Please answer the question before proceeding."); return; } currentQuestion.style.display = "none"; if (nextQuestion) { nextQuestion.style.display = "block"; } else { // Calculate the result and display it in the result div const { dominantStyle, stylePercentages } = calculateResult(); const resultDiv = document.getElementById("result"); resultDiv.innerHTML = ` Your dominant style is: ${dominantStyle} Classic: ${stylePercentages.Classic.toFixed(2)}% Trendy: ${stylePercentages.Trendy.toFixed(2)}% Bohemian: ${stylePercentages.Bohemian.toFixed(2)}% Minimalist: ${stylePercentages.Minimalist.toFixed(2)}% `; resultDiv.style.display = "block"; // Show the retake button const retakeDiv = document.getElementById("retake"); retakeDiv.style.display = "block"; } }); }); function calculateResult() { const styleCount = { Classic: 0, Trendy: 0, Bohemian: 0, Minimalist: 0, }; const inputs = document.querySelectorAll("input[type='radio']:checked"); inputs.forEach((input) => { const style = input.getAttribute("data-style"); styleCount[style]++; }); const totalAnswers = inputs.length; const stylePercentages = { Classic: (styleCount.Classic / totalAnswers) * 100, Trendy: (styleCount.Trendy / totalAnswers) * 100, Bohemian: (styleCount.Bohemian / totalAnswers) * 100, Minimalist: (styleCount.Minimalist / totalAnswers) * 100, }; const dominantStyle = Object.keys(styleCount).reduce((a, b) => styleCount[a] > styleCount[b] ? a : b ); return { dominantStyle, stylePercentages }; } retakeButton.addEventListener("click", () => { const firstQuestion = document.getElementById("q1"); const resultDiv = document.getElementById("result"); const retakeDiv = document.getElementById("retake"); // Reset the quiz const inputs = document.querySelectorAll("input[type='radio']"); inputs.forEach((input) => { input.checked = false; }); // Hide the result div and retake button resultDiv.style.display = "none"; // Show the retake div document.getElementById("retake").style.display = "block"; // Show the first question firstQuestion.style.display = "block"; });