mirror of
https://github.com/Alvin-Zilverstand/Schoolkantine.git
synced 2026-03-07 05:53:00 +01:00
Merge branch 'main' of https://github.com/Alvin-Zilverstand/Schoolkantine
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<p>© 2025 vista </p>
|
||||
<p>© 2025 Vista </p>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -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) {
|
||||
var title = "";
|
||||
var imageSrc = "";
|
||||
@@ -58,18 +99,10 @@ function showItemDetails(item) {
|
||||
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
|
||||
function closeModal() {
|
||||
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();
|
||||
}
|
||||
document.getElementById('modal').style.display = 'none';
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
justify-content: space-between; /* Ensure the body content is spaced between */
|
||||
background-color: #f2c14e; /* Set the background color to yellow */
|
||||
justify-content: space-between;
|
||||
background-color: #f2c14e;
|
||||
}
|
||||
|
||||
/* Linkerkant menu */
|
||||
@@ -14,22 +14,15 @@ body {
|
||||
padding: 20px;
|
||||
height: 100vh;
|
||||
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 {
|
||||
background-color: #fff;
|
||||
padding: 20px; /* Increase padding for larger buttons */
|
||||
padding: 20px;
|
||||
margin: 10px 0;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 1.5em; /* Increase font size for larger buttons */
|
||||
font-size: 1.5em;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
@@ -38,12 +31,13 @@ body {
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
/* Productweergave in mooie hokjes */
|
||||
/* Productweergave in een grid */
|
||||
.product-display {
|
||||
width: 70%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 20px;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.product-box {
|
||||
@@ -54,26 +48,20 @@ body {
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.menu-detail img {
|
||||
width: 70%;
|
||||
max-width: 300px;
|
||||
max-height: 400px;
|
||||
margin-bottom: 20px;
|
||||
.product-box:hover {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.menu-detail h2 {
|
||||
color: #d32f2f;
|
||||
margin: 10px 0;
|
||||
.product-box img {
|
||||
width: 100%;
|
||||
max-height: 150px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.menu-item:hover {
|
||||
background-color: #f59e42;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
/* Modaal venster (pop-up) */
|
||||
/* Modaal venster */
|
||||
.modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
@@ -83,25 +71,24 @@ body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
overflow: auto; /* Allow scrolling within the modal */
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: white;
|
||||
margin: 5% auto; /* Reduce margin to fit more content */
|
||||
margin: 5% auto;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
width: 80%; /* Increase width to fit more content */
|
||||
max-width: 600px; /* Set a maximum width */
|
||||
width: 80%;
|
||||
max-width: 600px;
|
||||
text-align: center;
|
||||
max-height: 90vh; /* Ensure the modal content fits within the viewport height */
|
||||
overflow-y: auto; /* Allow vertical scrolling within the modal */
|
||||
max-height: 90vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.modal img {
|
||||
width: 100%;
|
||||
max-width: 300px; /* Ensure the image fits within the modal */
|
||||
height: auto; /* Maintain aspect ratio */
|
||||
max-width: 300px;
|
||||
height: auto;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
@@ -114,6 +101,23 @@ body {
|
||||
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 {
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
@@ -121,19 +125,8 @@ body {
|
||||
padding: 10px 20px;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#add-to-cart:hover {
|
||||
background-color: #45a049;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
footer {
|
||||
text-align: center;
|
||||
padding: 0px;
|
||||
background-color: #f2c14e;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user