Divinelysustainable's picture
as sennior elite fullstack html developer n designer, improve amritmilk.in into a more modern, creative, informational, interactive, resourceful n valuable website with vibrant colors, glass effects, gradients, calculators, blogs, tools, quizzes etc.
b9d9cf5 verified
Raw History Blame Contribute Delete
34.8 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Amrit Dairy - Fresh Milk & Dairy Products</title>
<link rel="icon" type="image/x-icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🥛</text></svg>">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');
* {
font-family: 'Poppins', sans-serif;
}
.glass {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.gradient-text {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.milk-gradient {
background: linear-gradient(135deg, #fff5e6 0%, #ffd4a3 50%, #ff9a56 100%);
}
.float-animation {
animation: float 6s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0px); }
50% { transform: translateY(-20px); }
}
.blob {
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
animation: blob 7s linear infinite;
}
@keyframes blob {
0%, 100% { transform: scale(1) rotate(0deg); }
50% { transform: scale(1.1) rotate(180deg); }
}
.shimmer {
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
background-size: 200% 100%;
animation: shimmer 2s infinite;
}
@keyframes shimmer {
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
.gradient-border {
background: linear-gradient(45deg, #f093fb, #f5576c, #4facfe, #00f2fe);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
padding: 3px;
border-radius: 1rem;
}
@keyframes gradient {
0%, 100% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
}
.product-card {
transition: all 0.3s ease;
}
.product-card:hover {
transform: translateY(-10px) scale(1.05);
}
.nav-item {
position: relative;
overflow: hidden;
}
.nav-item::after {
content: '';
position: absolute;
bottom: 0;
left: -100%;
width: 100%;
height: 2px;
background: linear-gradient(90deg, #ff9a56, #ffd4a3);
transition: left 0.3s ease;
}
.nav-item:hover::after {
left: 0;
}
</style>
</head>
<body class="bg-gradient-to-br from-purple-50 via-pink-50 to-orange-50 min-h-screen">
<!-- Navigation -->
<nav class="glass fixed w-full top-0 z-50 px-6 py-4">
<div class="max-w-7xl mx-auto flex justify-between items-center">
<div class="flex items-center space-x-2">
<span class="text-3xl">🥛</span>
<span class="text-2xl font-bold gradient-text">Amrit Dairy</span>
</div>
<div class="hidden md:flex space-x-8">
<a href="#home" class="nav-item text-gray-700 hover:text-purple-600 transition">Home</a>
<a href="#products" class="nav-item text-gray-700 hover:text-purple-600 transition">Products</a>
<a href="#calculator" class="nav-item text-gray-700 hover:text-purple-600 transition">Calculator</a>
<a href="#blog" class="nav-item text-gray-700 hover:text-purple-600 transition">Blog</a>
<a href="#quiz" class="nav-item text-gray-700 hover:text-purple-600 transition">Quiz</a>
<a href="#contact" class="nav-item text-gray-700 hover:text-purple-600 transition">Contact</a>
</div>
<button id="mobileMenuBtn" class="md:hidden">
<i data-feather="menu" class="w-6 h-6"></i>
</button>
</div>
</nav>
<!-- Mobile Menu -->
<div id="mobileMenu" class="fixed inset-0 bg-white z-40 transform translate-x-full transition-transform duration-300 md:hidden">
<div class="p-6">
<button id="closeMobileMenu" class="mb-8">
<i data-feather="x" class="w-6 h-6"></i>
</button>
<div class="flex flex-col space-y-4">
<a href="#home" class="text-lg text-gray-700">Home</a>
<a href="#products" class="text-lg text-gray-700">Products</a>
<a href="#calculator" class="text-lg text-gray-700">Calculator</a>
<a href="#blog" class="text-lg text-gray-700">Blog</a>
<a href="#quiz" class="text-lg text-gray-700">Quiz</a>
<a href="#contact" class="text-lg text-gray-700">Contact</a>
</div>
</div>
</div>
<!-- Hero Section -->
<section id="home" class="relative overflow-hidden pt-20 min-h-screen flex items-center">
<div class="absolute inset-0 blob milk-gradient opacity-20"></div>
<div class="relative max-w-7xl mx-auto px-6 py-20 grid md:grid-cols-2 gap-12 items-center">
<div>
<h1 class="text-5xl md:text-7xl font-bold mb-6">
<span class="gradient-text">Pure & Fresh</span><br>
Dairy Products
</h1>
<p class="text-gray-600 text-lg mb-8">
Experience the goodness of farm-fresh milk and premium dairy products delivered straight to your doorstep.
</p>
<div class="flex flex-wrap gap-4">
<button class="px-8 py-3 bg-gradient-to-r from-purple-600 to-pink-600 text-white rounded-full font-semibold hover:shadow-xl transition transform hover:scale-105 shimmer">
Order Now
</button>
<button class="px-8 py-3 glass text-purple-600 rounded-full font-semibold hover:shadow-xl transition transform hover:scale-105">
<i data-feather="play-circle" class="inline w-5 h-5 mr-2"></i>
Watch Video
</button>
</div>
<div class="mt-12 grid grid-cols-3 gap-8">
<div class="text-center">
<div class="text-3xl font-bold text-purple-600">10K+</div>
<div class="text-sm text-gray-600">Happy Customers</div>
</div>
<div class="text-center">
<div class="text-3xl font-bold text-purple-600">50+</div>
<div class="text-sm text-gray-600">Products</div>
</div>
<div class="text-center">
<div class="text-3xl font-bold text-purple-600">100%</div>
<div class="text-sm text-gray-600">Fresh</div>
</div>
</div>
</div>
<div class="relative">
<div class="float-animation">
<img src="http://static.photos/dairy/640x360/1" alt="Milk Products" class="rounded-3xl shadow-2xl">
</div>
<div class="absolute -bottom-10 -left-10 glass rounded-2xl p-6 transform rotate-3">
<div class="flex items-center space-x-3">
<span class="text-4xl">🌟</span>
<div>
<div class="font-semibold">Premium Quality</div>
<div class="text-sm text-gray-600">Certified Organic</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Products Section -->
<section id="products" class="py-20 px-6">
<div class="max-w-7xl mx-auto">
<div class="text-center mb-12">
<h2 class="text-4xl font-bold mb-4 gradient-text">Our Products</h2>
<p class="text-gray-600">Explore our range of fresh dairy products</p>
</div>
<div class="grid md:grid-cols-3 gap-8">
<div class="gradient-border">
<div class="bg-white rounded-2xl p-6 product-card">
<div class="h-48 mb-4 overflow-hidden rounded-xl">
<img src="http://static.photos/milk/320x240/2" alt="Fresh Milk" class="w-full h-full object-cover">
</div>
<h3 class="text-xl font-semibold mb-2">Fresh Milk</h3>
<p class="text-gray-600 mb-4">Pure and nutritious milk from happy cows</p>
<div class="flex justify-between items-center">
<span class="text-2xl font-bold text-purple-600">₹45/L</span>
<button class="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition">
Add to Cart
</button>
</div>
</div>
</div>
<div class="gradient-border">
<div class="bg-white rounded-2xl p-6 product-card">
<div class="h-48 mb-4 overflow-hidden rounded-xl">
<img src="http://static.photos/food/320x240/3" alt="Yogurt" class="w-full h-full object-cover">
</div>
<h3 class="text-xl font-semibold mb-2">Curd/Yogurt</h3>
<p class="text-gray-600 mb-4">Creamy and probiotic-rich yogurt</p>
<div class="flex justify-between items-center">
<span class="text-2xl font-bold text-purple-600">₹35/500g</span>
<button class="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition">
Add to Cart
</button>
</div>
</div>
</div>
<div class="gradient-border">
<div class="bg-white rounded-2xl p-6 product-card">
<div class="h-48 mb-4 overflow-hidden rounded-xl">
<img src="http://static.photos/food/320x240/4" alt="Cheese" class="w-full h-full object-cover">
</div>
<h3 class="text-xl font-semibold mb-2">Paneer/Cheese</h3>
<p class="text-gray-600 mb-4">Fresh cottage cheese, high protein</p>
<div class="flex justify-between items-center">
<span class="text-2xl font-bold text-purple-600">₹120/kg</span>
<button class="px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition">
Add to Cart
</button>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Calculator Section -->
<section id="calculator" class="py-20 px-6 bg-gradient-to-r from-purple-100 to-pink-100">
<div class="max-w-4xl mx-auto">
<div class="text-center mb-12">
<h2 class="text-4xl font-bold mb-4 gradient-text">Nutrition Calculator</h2>
<p class="text-gray-600">Calculate your daily dairy nutrition needs</p>
</div>
<div class="glass rounded-3xl p-8">
<div class="grid md:grid-cols-2 gap-6 mb-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Age</label>
<input type="number" id="age" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-500 focus:border-transparent" placeholder="Enter your age">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Weight (kg)</label>
<input type="number" id="weight" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-500 focus:border-transparent" placeholder="Enter your weight">
</div>
</div>
<div class="mb-6">
<label class="block text-sm font-medium text-gray-700 mb-2">Activity Level</label>
<select id="activity" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-500 focus:border-transparent">
<option value="sedentary">Sedentary</option>
<option value="moderate">Moderately Active</option>
<option value="active">Very Active</option>
</select>
</div>
<button onclick="calculateNutrition()" class="w-full py-3 bg-gradient-to-r from-purple-600 to-pink-600 text-white rounded-lg font-semibold hover:shadow-xl transition">
Calculate Daily Dairy Needs
</button>
<div id="nutritionResult" class="mt-6 p-6 bg-white rounded-xl hidden">
<h3 class="text-lg font-semibold mb-4">Your Daily Dairy Recommendations:</h3>
<div class="space-y-3">
<div class="flex justify-between">
<span>Milk Required:</span>
<span id="milkRequired" class="font-bold text-purple-600"></span>
</div>
<div class="flex justify-between">
<span>Calcium Intake:</span>
<span id="calciumIntake" class="font-bold text-purple-600"></span>
</div>
<div class="flex justify-between">
<span>Protein from Dairy:</span>
<span id="proteinIntake" class="font-bold text-purple-600"></span>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Blog Section -->
<section id="blog" class="py-20 px-6">
<div class="max-w-7xl mx-auto">
<div class="text-center mb-12">
<h2 class="text-4xl font-bold mb-4 gradient-text">Dairy Blog</h2>
<p class="text-gray-600">Tips, recipes, and dairy insights</p>
</div>
<div class="grid md:grid-cols-3 gap-8">
<article class="bg-white rounded-2xl overflow-hidden shadow-lg hover:shadow-2xl transition">
<img src="http://static.photos/nature/320x240/5" alt="Blog" class="w-full h-48 object-cover">
<div class="p-6">
<div class="flex items-center text-sm text-gray-500 mb-2">
<i data-feather="calendar" class="w-4 h-4 mr-1"></i>
March 15, 2024
</div>
<h3 class="text-xl font-semibold mb-2">Benefits of Fresh Milk</h3>
<p class="text-gray-600 mb-4">Discover the numerous health benefits of consuming fresh dairy daily...</p>
<a href="#" class="text-purple-600 font-semibold hover:text-purple-700">Read More →</a>
</div>
</article>
<article class="bg-white rounded-2xl overflow-hidden shadow-lg hover:shadow-2xl transition">
<img src="http://static.photos/food/320x240/6" alt="Blog" class="w-full h-48 object-cover">
<div class="p-6">
<div class="flex items-center text-sm text-gray-500 mb-2">
<i data-feather="calendar" class="w-4 h-4 mr-1"></i>
March 12, 2024
</div>
<h3 class="text-xl font-semibold mb-2">DIY Yogurt Recipe</h3>
<p class="text-gray-600 mb-4">Learn how to make delicious homemade yogurt with just two ingredients...</p>
<a href="#" class="text-purple-600 font-semibold hover:text-purple-700">Read More →</a>
</div>
</article>
<article class="bg-white rounded-2xl overflow-hidden shadow-lg hover:shadow-2xl transition">
<img src="http://static.photos/education/320x240/7" alt="Blog" class="w-full h-48 object-cover">
<div class="p-6">
<div class="flex items-center text-sm text-gray-500 mb-2">
<i data-feather="calendar" class="w-4 h-4 mr-1"></i>
March 10, 2024
</div>
<h3 class="text-xl font-semibold mb-2">Milk & Bone Health</h3>
<p class="text-gray-600 mb-4">Understanding the crucial role of dairy in maintaining strong bones...</p>
<a href="#" class="text-purple-600 font-semibold hover:text-purple-700">Read More →</a>
</div>
</article>
</div>
</div>
</section>
<!-- Quiz Section -->
<section id="quiz" class="py-20 px-6 bg-gradient-to-r from-orange-100 to-yellow-100">
<div class="max-w-4xl mx-auto">
<div class="text-center mb-12">
<h2 class="text-4xl font-bold mb-4 gradient-text">Dairy Knowledge Quiz</h2>
<p class="text-gray-600">Test your knowledge about dairy products</p>
</div>
<div class="glass rounded-3xl p-8">
<div id="quizContainer">
<div class="mb-6">
<h3 class="text-xl font-semibold mb-4">Question <span id="questionNumber">1</span> of 5</h3>
<p id="questionText" class="text-lg mb-4">How much calcium does one glass of milk contain approximately?</p>
<div class="space-y-3">
<label class="block cursor-pointer">
<input type="radio" name="answer" value="0" class="mr-2">
<span class="px-4 py-2 bg-white rounded-lg inline-block w-full hover:bg-purple-50 transition">100mg</span>
</label>
<label class="block cursor-pointer">
<input type="radio" name="answer" value="1" class="mr-2">
<span class="px-4 py-2 bg-white rounded-lg inline-block w-full hover:bg-purple-50 transition">300mg</span>
</label>
<label class="block cursor-pointer">
<input type="radio" name="answer" value="2" class="mr-2">
<span class="px-4 py-2 bg-white rounded-lg inline-block w-full hover:bg-purple-50 transition">500mg</span>
</label>
<label class="block cursor-pointer">
<input type="radio" name="answer" value="3" class="mr-2">
<span class="px-4 py-2 bg-white rounded-lg inline-block w-full hover:bg-purple-50 transition">700mg</span>
</label>
</div>
</div>
<div class="flex justify-between">
<button onclick="previousQuestion()" class="px-6 py-2 bg-gray-300 text-gray-700 rounded-lg hover:bg-gray-400 transition">
Previous
</button>
<button onclick="nextQuestion()" class="px-6 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition">
Next
</button>
</div>
</div>
<div id="quizResult" class="hidden text-center">
<div class="text-6xl mb-4">🏆</div>
<h3 class="text-2xl font-bold mb-4">Quiz Complete!</h3>
<p class="text-lg mb-4">Your Score: <span id="score" class="font-bold text-purple-600">0</span>/5</p>
<button onclick="restartQuiz()" class="px-6 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition">
Restart Quiz
</button>
</div>
</div>
</div>
</section>
<!-- Contact Section -->
<section id="contact" class="py-20 px-6">
<div class="max-w-7xl mx-auto">
<div class="text-center mb-12">
<h2 class="text-4xl font-bold mb-4 gradient-text">Get in Touch</h2>
<p class="text-gray-600">We'd love to hear from you</p>
</div>
<div class="grid md:grid-cols-2 gap-12">
<div>
<div class="bg-white rounded-2xl p-8 shadow-lg">
<h3 class="text-2xl font-semibold mb-6">Send us a Message</h3>
<form onsubmit="handleSubmit(event)">
<div class="mb-4">
<input type="text" placeholder="Your Name" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-500 focus:border-transparent">
</div>
<div class="mb-4">
<input type="email" placeholder="Your Email" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-500 focus:border-transparent">
</div>
<div class="mb-4">
<textarea placeholder="Your Message" rows="4" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:ring-2 focus:ring-purple-500 focus:border-transparent"></textarea>
</div>
<button type="submit" class="w-full py-3 bg-gradient-to-r from-purple-600 to-pink-600 text-white rounded-lg font-semibold hover:shadow-xl transition">
Send Message
</button>
</form>
</div>
</div>
<div class="space-y-6">
<div class="bg-white rounded-2xl p-6 shadow-lg flex items-start space-x-4">
<div class="bg-purple-100 p-3 rounded-lg">
<i data-feather="map-pin" class="w-6 h-6 text-purple-600"></i>
</div>
<div>
<h4 class="font-semibold mb-1">Visit Us</h4>
<p class="text-gray-600">123 Dairy Lane, Milk City<br>New Delhi, 110001</p>
</div>
</div>
<div class="bg-white rounded-2xl p-6 shadow-lg flex items-start space-x-4">
<div class="bg-purple-100 p-3 rounded-lg">
<i data-feather="phone" class="w-6 h-6 text-purple-600"></i>
</div>
<div>
<h4 class="font-semibold mb-1">Call Us</h4>
<p class="text-gray-600">+91 98765 43210<br>+91 98765 43211</p>
</div>
</div>
<div class="bg-white rounded-2xl p-6 shadow-lg flex items-start space-x-4">
<div class="bg-purple-100 p-3 rounded-lg">
<i data-feather="mail" class="w-6 h-6 text-purple-600"></i>
</div>
<div>
<h4 class="font-semibold mb-1">Email Us</h4>
<p class="text-gray-600">info@amritdairy.com<br>support@amritdairy.com</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="bg-gradient-to-r from-purple-900 to-pink-900 text-white py-12 px-6">
<div class="max-w-7xl mx-auto">
<div class="grid md:grid-cols-4 gap-8 mb-8">
<div>
<div class="flex items-center space-x-2 mb-4">
<span class="text-3xl">🥛</span>
<span class="text-2xl font-bold">Amrit Dairy</span>
</div>
<p class="text-purple-200">Fresh, pure, and nutritious dairy products for your family.</p>
</div>
<div>
<h4 class="font-semibold mb-4">Quick Links</h4>
<ul class="space-y-2 text-purple-200">
<li><a href="#home" class="hover:text-white transition">Home</a></li>
<li><a href="#products" class="hover:text-white transition">Products</a></li>
<li><a href="#blog" class="hover:text-white transition">Blog</a></li>
<li><a href="#contact" class="hover:text-white transition">Contact</a></li>
</ul>
</div>
<div>
<h4 class="font-semibold mb-4">Products</h4>
<ul class="space-y-2 text-purple-200">
<li><a href="#" class="hover:text-white transition">Fresh Milk</a></li>
<li><a href="#" class="hover:text-white transition">Curd</a></li>
<li><a href="#" class="hover:text-white transition">Paneer</a></li>
<li><a href="#" class="hover:text-white transition">Butter</a></li>
</ul>
</div>
<div>
<h4 class="font-semibold mb-4">Follow Us</h4>
<div class="flex space-x-4">
<a href="#" class="bg-purple-800 p-2 rounded-lg hover:bg-purple-700 transition">
<i data-feather="facebook" class="w-5 h-5"></i>
</a>
<a href="#" class="bg-purple-800 p-2 rounded-lg hover:bg-purple-700 transition">
<i data-feather="twitter" class="w-5 h-5"></i>
</a>
<a href="#" class="bg-purple-800 p-2 rounded-lg hover:bg-purple-700 transition">
<i data-feather="instagram" class="w-5 h-5"></i>
</a>
<a href="#" class="bg-purple-800 p-2 rounded-lg hover:bg-purple-700 transition">
<i data-feather="youtube" class="w-5 h-5"></i>
</a>
</div>
</div>
</div>
<div class="border-t border-purple-800 pt-8 text-center text-purple-200">
<p>&copy; 2024 Amrit Dairy. All rights reserved. Made with ❤️ in India</p>
</div>
</div>
</footer>
<script>
// Mobile Menu
const mobileMenuBtn = document.getElementById('mobileMenuBtn');
const closeMobileMenu = document.getElementById('closeMobileMenu');
const mobileMenu = document.getElementById('mobileMenu');
mobileMenuBtn.addEventListener('click', () => {
mobileMenu.classList.remove('translate-x-full');
});
closeMobileMenu.addEventListener('click', () => {
mobileMenu.classList.add('translate-x-full');
});
// Nutrition Calculator
function calculateNutrition() {
const age = document.getElementById('age').value;
const weight = document.getElementById('weight').value;
const activity = document.getElementById('activity').value;
if (!age || !weight) {
alert('Please fill in all fields');
return;
}
let milkRequired = 500; // base ml
if (activity === 'moderate') milkRequired = 600;
if (activity === 'active') milkRequired = 750;
const calcium = (milkRequired * 0.30).toFixed(1);
const protein = (milkRequired * 0.034).toFixed(1);
document.getElementById('milkRequired').textContent = `${milkRequired} ml`;
document.getElementById('calciumIntake').textContent = `${calcium} mg`;
document.getElementById('proteinIntake').textContent = `${protein} g`;
document.getElementById('nutritionResult').classList.remove('hidden');
anime({
targets: '#nutritionResult',
scale: [0.9, 1],
opacity: [0, 1],
duration: 500,
easing: 'easeOutExpo'
});
}
// Quiz Logic
const quizQuestions = [
{
question: "How much calcium does one glass of milk contain approximately?",
options: ["100mg", "300mg", "500mg", "700mg"],
correct: 1
},
{
question: "Which vitamin is naturally present in milk?",
options: ["Vitamin C", "Vitamin D", "Vitamin K", "Vitamin B12"],
correct: 1
},
{
question: "What is the main protein in milk?",
options: ["Whey", "Casein", "Albumin", "Globulin"],
correct: 1
},
{
question: "How long can fresh milk be refrigerated?",
options: ["2-3 days", "5-7 days", "10-14 days", "1 month"],
correct: 1
},
{
question: "Which bacteria is used to make yogurt?",
options: ["E. coli", "Lactobacillus", "Salmonella", "Staphylococcus"],
correct: 1
}
];
let currentQuestion = 0;
let score = 0;
function loadQuestion() {
const question = quizQuestions[currentQuestion];
document.getElementById('questionNumber').textContent = currentQuestion + 1;
document.getElementById('questionText').textContent = question.question;
const optionsHTML = question.options.map((option, index) => `
<label class="block cursor-pointer">
<input type="radio" name="answer" value="${index}" class="mr-2">
<span class="px-4 py-2 bg-white rounded-lg inline-block w-full hover:bg-purple-50 transition">${option}</span>
</label>
`).join('');
document.querySelector('#quizContainer .space-y-3').innerHTML = optionsHTML;
}
function nextQuestion() {
const selected = document.querySelector('input[name="answer"]:checked');
if (!selected) {
alert('Please select an answer');
return;
}
if (parseInt(selected.value) === quizQuestions[currentQuestion].correct) {
score++;
}
currentQuestion++;
if (currentQuestion >= quizQuestions.length) {
showQuizResult();
} else {
loadQuestion();
}
}
function previousQuestion() {
if (currentQuestion > 0) {
currentQuestion--;
loadQuestion();
}
}
function showQuizResult() {
document.getElementById('quizContainer').classList.add('hidden');
document.getElementById('quizResult').classList.remove('hidden');
document.getElementById('score').textContent = score;
}
function restartQuiz() {
currentQuestion = 0;
score = 0;
document.getElementById('quizContainer').classList.remove('hidden');
document.getElementById('quizResult').classList.add('hidden');
loadQuestion();
}
function handleSubmit(event) {
event.preventDefault();
alert('Thank you for your message! We will get back to you soon.');
event.target.reset();
}
// Initialize
feather.replace();
loadQuestion();
// Smooth scrolling
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({ behavior: 'smooth' });
// Close mobile menu if open
mobileMenu.classList.add('translate-x-full');
}
});
});
// Add animations on scroll
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
anime({
targets: entry.target,
translateY: [50, 0],
opacity: [0, 1],
duration: 800,
easing: 'easeOutExpo'
});
observer.unobserve(entry.target);
}
});
}, observerOptions);
document.querySelectorAll('section').forEach(section => {
observer.observe(section);
});
</script>
</body>
</html>