diff --git a/filter.js b/filter.js index 3799d7f..e0f5a10 100644 --- a/filter.js +++ b/filter.js @@ -37,6 +37,7 @@ function applyFilters() { // Get selected values from checkboxes const selectedMeals = getSelectedValues('meal'); const selectedCuisines = getSelectedValues('cuisine'); + const selectedDietaryRestrictions = getSelectedValues('restrictions'); // New line // Get all place boxes const placeBoxes = document.querySelectorAll('.place-box'); @@ -48,16 +49,18 @@ function applyFilters() { placeBoxes.forEach(function (placeBox) { const placeMeal = placeBox.getAttribute('data-meal'); const placeCuisine = placeBox.getAttribute('data-cuisine').split(' '); // Split into an array + const placeDietaryRestrictions = placeBox.getAttribute('data-restrictions').split(' '); // New line const isMealMatch = selectedMeals.length === 0 || selectedMeals.some(meal => placeMeal.includes(meal)); const isCuisineMatch = selectedCuisines.length === 0 || selectedCuisines.every(cuisine => placeCuisine.includes(cuisine)); + const isDietaryRestrictionsMatch = selectedDietaryRestrictions.length === 0 || selectedDietaryRestrictions.every(dr => placeDietaryRestrictions.includes(dr)); // New line // Add search functionality const placeName = placeBox.querySelector('h3').innerText.toLowerCase(); const isSearchMatch = placeName.includes(searchQuery); // Show/hide place box based on filters and search query - placeBox.style.display = isMealMatch && isCuisineMatch && isSearchMatch ? 'block' : 'none'; + placeBox.style.display = isMealMatch && isCuisineMatch && isDietaryRestrictionsMatch && isSearchMatch ? 'block' : 'none'; // Updated line }); } diff --git a/index.html b/index.html index 9762b33..2ce07f2 100644 --- a/index.html +++ b/index.html @@ -64,80 +64,92 @@
A cozy place offering a variety of delicious meals. Perfect for a quick bite or a leisurely meal.
Learn MoreHealthy and fresh options for those looking for nutritious meals. Salads, smoothies, and more!
Learn MoreHealthy and fresh options for those looking for nutritious meals. Salads, smoothies, and more!
Learn MoreHealthy and fresh options for those looking for nutritious meals. Salads, smoothies, and more!
Learn MoreHealthy and fresh options for those looking for nutritious meals. Salads, smoothies, and more!
Learn MoreHealthy and fresh options for those looking for nutritious meals. Salads, smoothies, and more!
Learn MoreHealthy and fresh options for those looking for nutritious meals. Salads, smoothies, and more!
Learn MoreA cozy place offering a variety of delicious meals. Perfect for a quick bite or a leisurely meal.
Learn MoreHealthy and fresh options for those looking for nutritious meals. Salads, smoothies, and more!
Learn MoreSaddles Cafe is dedicated to providing an exquisite selection of specialty coffee and tea beverages, complemented by an @@ -145,14 +157,14 @@
Healthy and fresh options for those looking for nutritious meals. Salads, smoothies, and more!
Learn MoreExperience a unique culinary journey at Fitbites, where we bring together a delightful blend of diverse cuisines.
diff --git a/styles.css b/styles.css index 0b7cc38..97c2d35 100644 --- a/styles.css +++ b/styles.css @@ -131,7 +131,7 @@ nav a:hover { display: flex; flex-wrap: wrap; /* Allow wrapping to the next line when there's not enough space */ margin-left: 350px; - margin-top: -400px; + margin-top: -550px; } .search-container {