the category page navigation doesnt work yet - Follow Up Deployment
Browse files- index.html +52 -11
index.html
CHANGED
|
@@ -30,33 +30,74 @@
|
|
| 30 |
}
|
| 31 |
</style>
|
| 32 |
<script>
|
| 33 |
-
// Handle
|
| 34 |
document.addEventListener('DOMContentLoaded', function() {
|
| 35 |
-
|
| 36 |
-
const mobileDealsNavLink = document.getElementById('mobile-deals-nav-link');
|
| 37 |
const landingPage = document.getElementById('landing-page');
|
| 38 |
const dealsPage = document.getElementById('deals-page');
|
|
|
|
| 39 |
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
landingPage.classList.add('hidden');
|
| 42 |
-
dealsPage.classList.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
// Update active state in navigation
|
| 44 |
document.querySelectorAll('nav a').forEach(link => {
|
| 45 |
link.classList.remove('border-blue-500', 'text-gray-900');
|
| 46 |
link.classList.add('border-transparent', 'text-gray-500');
|
| 47 |
});
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
|
|
|
|
| 52 |
dealsNavLink.addEventListener('click', function(e) {
|
| 53 |
e.preventDefault();
|
| 54 |
-
|
| 55 |
});
|
| 56 |
|
| 57 |
mobileDealsNavLink.addEventListener('click', function(e) {
|
| 58 |
e.preventDefault();
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
});
|
| 61 |
|
| 62 |
// Deal countdown timer
|
|
@@ -109,7 +150,7 @@
|
|
| 109 |
</a>
|
| 110 |
<div class="hidden sm:ml-6 sm:flex sm:space-x-8">
|
| 111 |
<a href="#" class="border-blue-500 text-gray-900 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Home</a>
|
| 112 |
-
<a href="#" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Categories</a>
|
| 113 |
<a href="#" id="deals-nav-link" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Deals</a>
|
| 114 |
<a href="#" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Sell</a>
|
| 115 |
</div>
|
|
@@ -155,7 +196,7 @@
|
|
| 155 |
<div id="mobile-menu" class="hidden sm:hidden">
|
| 156 |
<div class="pt-2 pb-3 space-y-1">
|
| 157 |
<a href="#" class="bg-blue-50 border-blue-500 text-blue-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Home</a>
|
| 158 |
-
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Categories</a>
|
| 159 |
<a href="#" id="mobile-deals-nav-link" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Deals</a>
|
| 160 |
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Sell</a>
|
| 161 |
</div>
|
|
|
|
| 30 |
}
|
| 31 |
</style>
|
| 32 |
<script>
|
| 33 |
+
// Handle page navigation
|
| 34 |
document.addEventListener('DOMContentLoaded', function() {
|
| 35 |
+
// Get all page elements
|
|
|
|
| 36 |
const landingPage = document.getElementById('landing-page');
|
| 37 |
const dealsPage = document.getElementById('deals-page');
|
| 38 |
+
const categoryPage = document.getElementById('category-page');
|
| 39 |
|
| 40 |
+
// Get navigation links
|
| 41 |
+
const dealsNavLink = document.getElementById('deals-nav-link');
|
| 42 |
+
const mobileDealsNavLink = document.getElementById('mobile-deals-nav-link');
|
| 43 |
+
const categoriesNavLinks = document.querySelectorAll('[data-nav="categories"]');
|
| 44 |
+
const mobileCategoriesNavLinks = document.querySelectorAll('[data-nav="mobile-categories"]');
|
| 45 |
+
|
| 46 |
+
function showPage(page) {
|
| 47 |
+
// Hide all pages
|
| 48 |
landingPage.classList.add('hidden');
|
| 49 |
+
dealsPage.classList.add('hidden');
|
| 50 |
+
categoryPage.classList.add('hidden');
|
| 51 |
+
|
| 52 |
+
// Show requested page
|
| 53 |
+
if (page === 'deals') {
|
| 54 |
+
dealsPage.classList.remove('hidden');
|
| 55 |
+
} else if (page === 'categories') {
|
| 56 |
+
categoryPage.classList.remove('hidden');
|
| 57 |
+
} else {
|
| 58 |
+
landingPage.classList.remove('hidden');
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
// Update active state in navigation
|
| 62 |
document.querySelectorAll('nav a').forEach(link => {
|
| 63 |
link.classList.remove('border-blue-500', 'text-gray-900');
|
| 64 |
link.classList.add('border-transparent', 'text-gray-500');
|
| 65 |
});
|
| 66 |
+
|
| 67 |
+
if (page === 'deals') {
|
| 68 |
+
dealsNavLink.classList.remove('border-transparent', 'text-gray-500');
|
| 69 |
+
dealsNavLink.classList.add('border-blue-500', 'text-gray-900');
|
| 70 |
+
} else if (page === 'categories') {
|
| 71 |
+
categoriesNavLinks.forEach(link => {
|
| 72 |
+
link.classList.remove('border-transparent', 'text-gray-500');
|
| 73 |
+
link.classList.add('border-blue-500', 'text-gray-900');
|
| 74 |
+
});
|
| 75 |
+
}
|
| 76 |
}
|
| 77 |
|
| 78 |
+
// Navigation event listeners
|
| 79 |
dealsNavLink.addEventListener('click', function(e) {
|
| 80 |
e.preventDefault();
|
| 81 |
+
showPage('deals');
|
| 82 |
});
|
| 83 |
|
| 84 |
mobileDealsNavLink.addEventListener('click', function(e) {
|
| 85 |
e.preventDefault();
|
| 86 |
+
showPage('deals');
|
| 87 |
+
});
|
| 88 |
+
|
| 89 |
+
categoriesNavLinks.forEach(link => {
|
| 90 |
+
link.addEventListener('click', function(e) {
|
| 91 |
+
e.preventDefault();
|
| 92 |
+
showPage('categories');
|
| 93 |
+
});
|
| 94 |
+
});
|
| 95 |
+
|
| 96 |
+
mobileCategoriesNavLinks.forEach(link => {
|
| 97 |
+
link.addEventListener('click', function(e) {
|
| 98 |
+
e.preventDefault();
|
| 99 |
+
showPage('categories');
|
| 100 |
+
});
|
| 101 |
});
|
| 102 |
|
| 103 |
// Deal countdown timer
|
|
|
|
| 150 |
</a>
|
| 151 |
<div class="hidden sm:ml-6 sm:flex sm:space-x-8">
|
| 152 |
<a href="#" class="border-blue-500 text-gray-900 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Home</a>
|
| 153 |
+
<a href="#" data-nav="categories" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Categories</a>
|
| 154 |
<a href="#" id="deals-nav-link" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Deals</a>
|
| 155 |
<a href="#" class="border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Sell</a>
|
| 156 |
</div>
|
|
|
|
| 196 |
<div id="mobile-menu" class="hidden sm:hidden">
|
| 197 |
<div class="pt-2 pb-3 space-y-1">
|
| 198 |
<a href="#" class="bg-blue-50 border-blue-500 text-blue-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Home</a>
|
| 199 |
+
<a href="#" data-nav="mobile-categories" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Categories</a>
|
| 200 |
<a href="#" id="mobile-deals-nav-link" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Deals</a>
|
| 201 |
<a href="#" class="border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium">Sell</a>
|
| 202 |
</div>
|