This commit is contained in:
cowboykipnugget
2025-02-12 09:47:28 +01:00
parent 68ae3bc3d9
commit 20c5fb21d5
3 changed files with 144 additions and 69 deletions

View File

@@ -12,29 +12,31 @@
<!-- Linkerkant menu --> <!-- Linkerkant menu -->
<div class="menu-list"> <div class="menu-list">
<h2>Menu</h2> <h2>Menu</h2>
<!-- Broodje Gezond --> <div class="menu-item" onclick="showItemDetails('Broodjes')">Broodjes</div>
<div class="menu-item" onclick="showItemDetails('Broodjes')">Broodje Gezond</div> <div class="menu-item" onclick="showItemDetails('drinks')">Drinken</div>
<!-- Spa Water --> <div class="menu-item" onclick="showItemDetails('Snacks')">Snacks</div>
<div class="menu-item" onclick="showItemDetails('drinks')">Spa Water</div>
<!-- Frikandel -->
<div class="menu-item" onclick="showItemDetails('Snacks')">Frikandel</div>
<!-- Ijsjes -->
<div class="menu-item" onclick="showItemDetails('deserts')">Ijsjes</div> <div class="menu-item" onclick="showItemDetails('deserts')">Ijsjes</div>
<!-- Placeholder Items -->
<div class="menu-item" onclick="showItemDetails('Placeholder1')">Placeholder 1</div>
<div class="menu-item" onclick="showItemDetails('Placeholder2')">Placeholder 2</div>
</div> </div>
<div id="menu-detail" class="menu-detail"> <!-- Rechterkant: Productafbeeldingen in mooie hokjes -->
<h2 id="item-title">Selecteer een item</h2> <div id="product-display" class="product-display">
<img id="item-image" src="" alt=""> <!-- Hier komen de items die worden weergegeven als afbeeldingen -->
<p id="item-description"></p> </div>
<!-- Modaal venster voor grotere afbeelding en beschrijving -->
<div id="modal" class="modal" onclick="closeModal()">
<div class="modal-content">
<span class="close" onclick="closeModal()">&times;</span>
<h2 id="modal-title"></h2>
<img id="modal-image" src="" alt="">
<p id="modal-description"></p>
</div>
</div> </div>
<footer> <footer>
<p>&copy; 2025 McDonald's</p> <p>&copy; 2025 McDonald's</p>
</footer> </footer>
<script src="script.js"></script>
</body> </body>
<script src="script.js"></script>
</html> </html>

View File

@@ -1,42 +1,69 @@
// Functie om de details van een geselecteerd item weer te geven // Functie om de details van een geselecteerd item weer te geven
function showItemDetails(item) { function showItemDetails(item) {
var title = ''; var items = [];
var description = '';
var imageSrc = '';
// Afhankelijk van het geselecteerde item, pas de details aan // Afhankelijk van het geselecteerde item, voeg de producten toe
if (item === 'Broodjes') { if (item === 'Broodjes') {
title = "Broodje gezond"; items = [
imageSrc = "https://thumbs.dreamstime.com/b/submarine-sandwich-ham-cheese-clipping-path-egg-tomato-cucumber-lettuce-white-48580716.jpg"; {
description = "Op dit broodje zit kaas, veldsla, komkommer, tomaat, ei, ham en/of kip en bufkes saus."; title: "Broodje Gezond",
image: "https://thumbs.dreamstime.com/b/submarine-sandwich-ham-cheese-clipping-path-egg-tomato-cucumber-lettuce-white-48580716.jpg",
description: "Op dit broodje zit kaas, veldsla, komkommer, tomaat, ei, ham en/of kip en bufkes saus."
}
];
} else if (item === 'drinks') { } else if (item === 'drinks') {
title = "Spa water"; items = [
imageSrc = "https://m.media-amazon.com/images/I/71VrczELeaL._AC_SY741_.jpg"; {
description = "Koude verfrissende water"; title: "Spa Water",
image: "https://m.media-amazon.com/images/I/71VrczELeaL._AC_SY741_.jpg",
description: "Koude verfrissende water."
}
];
} else if (item === 'Snacks') { } else if (item === 'Snacks') {
title = "Frikandel"; items = [
imageSrc = "https://boshuis.huisjebezorgd.nl/wp-content/uploads/2020/03/29512948_652505005141152_1601506864166600704_o.jpg"; {
description = "Een frikandel, dat wil je wel!"; title: "Frikandel",
image: "https://boshuis.huisjebezorgd.nl/wp-content/uploads/2020/03/29512948_652505005141152_1601506864166600704_o.jpg",
description: "Een frikandel, dat wil je wel!"
}
];
} else if (item === 'deserts') { } else if (item === 'deserts') {
title = "Ijsjes"; items = [
imageSrc = "https://th.bing.com/th/id/R.5e81f369a0da6a92106391e7b0a5119b?rik=KD0kNGiRjGM22g&riu=http%3a%2f%2fwww.brookersicecream.com%2fwp-content%2fuploads%2f2018%2f09%2fIce-Cream-Fan.png&ehk=%2bfZOURa%2fKgmE4uuuESx9We3OBrwXpPaaMZpJaBJt4bo%3d&risl=&pid=ImgRaw&r=0"; {
description = "Een lekker ijsje met vele smaken, zoals aardbei, vannille, chocolade, mint, bosbes en nog veel meer (alleen in de zomer!)"; title: "Ijsjes",
} else if (item === 'Placeholder1') { image: "https://th.bing.com/th/id/R.5e81f369a0da6a92106391e7b0a5119b?rik=KD0kNGiRjGM22g&riu=http%3a%2f%2fwww.brookersicecream.com%2fwp-content%2fuploads%2f2018%2f09%2fIce-Cream-Fan.png&ehk=%2bfZOURa%2fKgmE4uuuESx9We3OBrwXpPaaMZpJaBJt4bo%3d&risl=&pid=ImgRaw&r=0",
title = "Placeholder 1"; description: "Een lekker ijsje met vele smaken, zoals aardbei, vanille, chocolade, mint, bosbes en nog veel meer (alleen in de zomer!)."
image = ""; }
description = "Beschrijving voor Placeholder 1."; ];
} else if (item === 'Placeholder2') {
title = "Placeholder 2";
image = "";
description = "Beschrijving voor Placeholder 2.";
} }
// Leeg de productweergave
const productDisplay = document.getElementById('product-display');
productDisplay.innerHTML = '';
// Toon de details aan de rechterkant // Voeg de items toe aan de weergave
document.getElementById("item-title").innerText = title; items.forEach(item => {
document.getElementById("item-image").src = imageSrc; const productBox = document.createElement('div');
document.getElementById("item-description").innerText = description; productBox.classList.add('product-box');
productBox.innerHTML = `
<img src="${item.image}" alt="${item.title}" onclick="openModal('${item.title}', '${item.image}', '${item.description}')">
<h3>${item.title}</h3>
`;
productDisplay.appendChild(productBox);
});
}
// Zorg ervoor dat de detailsectie zichtbaar wordt // Functie om het modaal venster te openen
document.getElementById("menu-detail").style.display = "block"; function openModal(title, image, description) {
} document.getElementById("modal-title").innerText = title;
document.getElementById("modal-image").src = image;
document.getElementById("modal-description").innerText = description;
// Zet het modaal venster zichtbaar
document.getElementById("modal").style.display = "block";
}
// Functie om het modaal venster te sluiten
function closeModal() {
document.getElementById("modal").style.display = "none";
}

View File

@@ -1,11 +1,11 @@
/* Algemeen stijlen */ /* Algemene body */
body { body {
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
margin: 0; margin: 0;
display: flex; display: flex;
} }
/* Linkerkant: Het menu */ /* Linkerkant menu */
.menu-list { .menu-list {
width: 30%; width: 30%;
background-color: #f2c14e; background-color: #f2c14e;
@@ -27,38 +27,84 @@ body {
border-radius: 8px; border-radius: 8px;
cursor: pointer; cursor: pointer;
font-size: 1.2em; font-size: 1.2em;
transition: all 0.3s ease;
} }
.menu-item:hover { .menu-item:hover {
background-color: #f59e42; background-color: #f59e42;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
} }
/* Rechterkant: Detail weergave */ /* Productweergave in mooie hokjes */
.menu-detail { .product-display {
width: 70%; width: 70%;
background-color: white; display: flex;
flex-wrap: wrap;
padding: 20px; padding: 20px;
display: none; /* Start verborgen */
} }
.menu-detail img { .product-box {
width: 70%; width: 200px;
max-width: 200px; margin: 10px;
max-height: 400px; border-radius: 8px;
margin-bottom: 20px; overflow: hidden;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
text-align: center;
cursor: pointer;
} }
.menu-detail h2 { .product-box img {
width: 100%;
height: auto;
transition: transform 0.3s ease;
}
.product-box:hover img {
transform: scale(1.1);
}
.product-box h3 {
font-size: 1.1em;
color: #d32f2f; color: #d32f2f;
font-size: 2em; margin: 10px 0;
} }
.menu-detail p { /* Modaal venster (pop-up) */
font-size: 1.2em; .modal {
color: #555; display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
background-color: white;
margin: 15% auto;
padding: 20px;
border-radius: 8px;
width: 60%;
text-align: center;
}
.modal img {
width: 100%;
max-width: 200px;
margin: 20px 0; margin: 20px 0;
} }
.close {
position: absolute;
top: 10px;
right: 20px;
font-size: 30px;
font-weight: bold;
cursor: pointer;
}
/* Footer */ /* Footer */
footer { footer {
text-align: center; text-align: center;