This commit is contained in:
vista-man
2025-02-12 13:54:42 +01:00
3 changed files with 84 additions and 58 deletions

View File

@@ -44,9 +44,9 @@
<p>Totaal: €<span id="total-price">0.00</span></p> <p>Totaal: €<span id="total-price">0.00</span></p>
<button id="order-button">Bestellen</button> <button id="order-button">Bestellen</button>
</div> </div>
<footer> <footer>
<p>&copy; 2025 vista </p> <p>&copy; 2025 Vista </p>
</footer> </footer>
</body> </body>

View File

@@ -1,4 +1,45 @@
// Functie om de details van een geselecteerd item weer te geven // Functie om de productcategorie te tonen
function showCategory(category) {
const productDisplay = document.getElementById('product-display');
productDisplay.innerHTML = ''; // Maak het display leeg voordat we nieuwe items toevoegen
let items = [];
// Afhankelijk van de gekozen categorie, voeg je de juiste producten toe
if (category === 'Broodjes') {
items = [
{ title: "Broodje Gezond", imageSrc: "media/broodje-gezond.jpg", price: 3.50 },
{ title: "Broodje Kaas", imageSrc: "media/broodje-kaas.jpg", price: 3.00 },
];
} else if (category === 'drinks') {
items = [
{ title: "Spa Water", imageSrc: "media/spa.webp", price: 1.00 },
{ title: "Cola", imageSrc: "media/cola.jpg", price: 1.50 },
];
} else if (category === 'Snacks') {
items = [
{ title: "Frikandel", imageSrc: "media/frikandel.jpg", price: 2.00 },
{ title: "Bitterballen", imageSrc: "media/bitterballen.jpg", price: 2.50 },
];
}
// Voeg de items toe aan de weergave
items.forEach(item => {
const productBox = document.createElement('div');
productBox.classList.add('product-box');
productBox.onclick = () => showItemDetails(item);
productBox.innerHTML = `
<img src="${item.imageSrc}" alt="${item.title}">
<h3>${item.title}</h3>
<p>€${item.price.toFixed(2)}</p>
`;
productDisplay.appendChild(productBox);
});
}
// Functie om de details van een item weer te geven in het modaal
function showItemDetails(item) { function showItemDetails(item) {
var title = ""; var title = "";
var imageSrc = ""; var imageSrc = "";
@@ -58,18 +99,10 @@ function showItemDetails(item) {
addToCart({ title, price }); addToCart({ title, price });
}; };
// Zet het modaal venster zichtbaar document.getElementById('modal').style.display = 'block';
document.getElementById("modal").style.display = "block";
} }
// Functie om het modaal venster te sluiten // Functie om het modaal venster te sluiten
function closeModal() { function closeModal() {
document.getElementById("modal").style.display = "none"; document.getElementById('modal').style.display = 'none';
}
// Zorg ervoor dat het modaal venster sluit wanneer er buiten het venster wordt geklikt
window.onclick = function(event) {
if (event.target == document.getElementById("modal")) {
closeModal();
}
} }

View File

@@ -3,8 +3,8 @@ body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
margin: 0; margin: 0;
display: flex; display: flex;
justify-content: space-between; /* Ensure the body content is spaced between */ justify-content: space-between;
background-color: #f2c14e; /* Set the background color to yellow */ background-color: #f2c14e;
} }
/* Linkerkant menu */ /* Linkerkant menu */
@@ -14,22 +14,15 @@ body {
padding: 20px; padding: 20px;
height: 100vh; height: 100vh;
overflow-y: auto; overflow-y: auto;
order: 1; /* Ensure the menu is on the left */
}
.menu-list h2 {
color: #d32f2f;
font-size: 2em;
margin-bottom: 20px;
} }
.menu-item { .menu-item {
background-color: #fff; background-color: #fff;
padding: 20px; /* Increase padding for larger buttons */ padding: 20px;
margin: 10px 0; margin: 10px 0;
border-radius: 8px; border-radius: 8px;
cursor: pointer; cursor: pointer;
font-size: 1.5em; /* Increase font size for larger buttons */ font-size: 1.5em;
transition: all 0.3s ease; transition: all 0.3s ease;
} }
@@ -38,12 +31,13 @@ body {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
} }
/* Productweergave in mooie hokjes */ /* Productweergave in een grid */
.product-display { .product-display {
width: 70%; width: 70%;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding: 20px; padding: 20px;
justify-content: space-around;
} }
.product-box { .product-box {
@@ -54,26 +48,20 @@ body {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
transition: all 0.3s ease;
} }
.menu-detail img { .product-box:hover {
width: 70%; transform: scale(1.05);
max-width: 300px;
max-height: 400px;
margin-bottom: 20px;
} }
.menu-detail h2 { .product-box img {
color: #d32f2f; width: 100%;
margin: 10px 0; max-height: 150px;
object-fit: cover;
} }
.menu-item:hover { /* Modaal venster */
background-color: #f59e42;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
/* Modaal venster (pop-up) */
.modal { .modal {
display: none; display: none;
position: fixed; position: fixed;
@@ -83,25 +71,24 @@ body {
width: 100%; width: 100%;
height: 100%; height: 100%;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
overflow: auto; /* Allow scrolling within the modal */
} }
.modal-content { .modal-content {
background-color: white; background-color: white;
margin: 5% auto; /* Reduce margin to fit more content */ margin: 5% auto;
padding: 20px; padding: 20px;
border-radius: 8px; border-radius: 8px;
width: 80%; /* Increase width to fit more content */ width: 80%;
max-width: 600px; /* Set a maximum width */ max-width: 600px;
text-align: center; text-align: center;
max-height: 90vh; /* Ensure the modal content fits within the viewport height */ max-height: 90vh;
overflow-y: auto; /* Allow vertical scrolling within the modal */ overflow-y: auto;
} }
.modal img { .modal img {
width: 100%; width: 100%;
max-width: 300px; /* Ensure the image fits within the modal */ max-width: 300px;
height: auto; /* Maintain aspect ratio */ height: auto;
margin: 20px 0; margin: 20px 0;
} }
@@ -114,6 +101,23 @@ body {
cursor: pointer; cursor: pointer;
} }
/* Winkelmandje */
.cart {
width: 25%;
padding: 20px;
background-color: #fff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.cart ul {
list-style-type: none;
padding: 0;
}
.cart li {
margin-bottom: 10px;
}
#add-to-cart { #add-to-cart {
background-color: #4CAF50; background-color: #4CAF50;
color: white; color: white;
@@ -121,19 +125,8 @@ body {
padding: 10px 20px; padding: 10px 20px;
cursor: pointer; cursor: pointer;
border-radius: 5px; border-radius: 5px;
margin-top: 20px;
} }
#add-to-cart:hover { #add-to-cart:hover {
background-color: #45a049; background-color: #45a049;
} }
/* Footer */
footer {
text-align: center;
padding: 0px;
background-color: #f2c14e;
position: fixed;
bottom: 0;
width: 100%;
}